code editing
While the agent handles complex tasks, you can also edit code directly in twig. This page covers the built-in editor features.
editor basics
Twig's editor is built on CodeMirror, providing a fast and capable editing experience.
opening files
- from the sidebar - click any file in the file tree
- quick open - use
cmd + pand type the filename - from the agent - click file links in agent responses
tabs
Multiple files open as tabs at the top of the editor:
- Click a tab to switch files
- Middle-click or click the X to close
- Drag tabs to reorder
- Right-click for more options (close others, close all)
saving
- auto-save - changes save automatically after a brief pause
- manual save -
cmd + sto save immediately - unsaved indicator - a dot appears on tabs with unsaved changes
editing features
syntax highlighting
Twig recognizes common languages and file types:
- JavaScript / TypeScript
- Python
- HTML / CSS
- JSON / YAML
- Markdown
- And many more
line numbers
Line numbers appear in the left gutter. Click a number to select the entire line.
indentation
Twig detects and matches your project's indentation style:
- Tab or spaces
- Indentation width (2 spaces, 4 spaces, etc.)
Use tab to indent, shift+tab to outdent.
code folding
Collapse blocks of code to focus on what matters:
- Click the arrow in the gutter to fold/unfold
cmd + shift + [to foldcmd + shift + ]to unfold
search and replace
find in file
cmd + f opens find in the current file:
- Type to search
- Use arrows or enter to move between matches
- Press escape to close
replace
cmd + h opens find and replace:
- Enter search term and replacement
- Replace one at a time or all at once
find in project
cmd + shift + f searches across all files:
- Results show in a panel
- Click a result to jump to that location
- Use filters to narrow by file type or folder
multiple cursors
Edit multiple locations simultaneously:
- add cursor -
cmd + clickto add cursors - select next occurrence -
cmd + dto select next match - select all occurrences -
cmd + shift + lto select all matches
Type, delete, or paste - the action applies to all cursor locations.
keyboard shortcuts
Common editing shortcuts:
| action | shortcut |
|---|---|
| save | cmd + s |
| undo | cmd + z |
| redo | cmd + shift + z |
| cut line | cmd + x (with nothing selected) |
| copy line | cmd + c (with nothing selected) |
| move line up | opt + up |
| move line down | opt + down |
| duplicate line | cmd + shift + d |
| delete line | cmd + shift + k |
| toggle comment | cmd + / |
working with the agent
The editor and agent work together:
- agent edits appear in the editor when approved
- click code in chat to see it in context
- select code and ask the agent about it
- point the agent to specific lines when describing tasks