Apps
Editor
# Editor — Deft Text Editor
A code editor for `.dft` files with syntax highlighting, multi-buffer editing, undo/redo, find/replace, code folding, and completion.
## Key Bindings
### Cursor Movement
| Key | Action |
|-----|--------|
| `Left` / `Right` | Move cursor left/right |
| `Up` / `Down` | Move cursor up/down |
| `Home` | Go to start of line |
| `End` | Go to end of line |
| `Ctrl+A` | Go to start of line |
| `Ctrl+E` | Go to end of line |
| `Ctrl+Left` | Move to previous word |
| `Ctrl+Right` | Move to next word |
| `Ctrl+Home` | Go to start of buffer |
| `Ctrl+End` | Go to end of buffer |
| `Page Up` / `Page Down` | Scroll page up/down |
### Selection
| Key | Action |
|-----|--------|
| `Shift+Left` / `Shift+Right` | Select left/right by character |
| `Shift+Up` / `Shift+Down` | Select up/down by line |
| `Shift+Home` / `Shift+End` | Select to line start/end |
| `Ctrl+Shift+Left` / `Ctrl+Shift+Right` | Select word left/right |
| `Ctrl+Shift+A` | Deselect |
| `Ctrl+Shift+E` | Select to end of line |
| `Ctrl+Shift+Home` / `Ctrl+Shift+End` | Select to buffer start/end |
| `Alt+A` | Select all |
### Editing
| Key | Action |
|-----|--------|
| `Enter` | Insert newline |
| `Backspace` | Delete character before cursor |
| `Delete` | Delete character after cursor |
| `Tab` | Insert tab |
| `Ctrl+Backspace` / `Alt+Backspace` | Delete word backward |
| `Ctrl+K` | Kill to end of line (at EOL, join with next line) |
| `Ctrl+K` `K` | Delete entire line |
| `Alt+Up` / `Alt+Down` | Move line up/down |
### Clipboard
| Key | Action |
|-----|--------|
| `Ctrl+C` | Copy selection |
| `Ctrl+X` | Cut selection |
| `Ctrl+V` | Paste |
### Undo / Redo
| Key | Action |
|-----|--------|
| `Ctrl+Z` | Undo |
| `Ctrl+Y` | Redo |
### File Operations
| Key | Action |
|-----|--------|
| `Ctrl+S` | Save file |
| `Ctrl+O` | Open file (picker) |
| `Ctrl+N` | New buffer |
| `Ctrl+W` | Close buffer |
| `Ctrl+Tab` | Next buffer |
File Watch (File ▸ File Watch): toggle watching the current file.
While watched, external changes on disk reload the buffer; unsaved edits
block the reload and are reported instead. A `● watch` indicator shows in
the status bar while the active file is watched.
Line endings: existing files keep the style they were opened with
(LF or CRLF); the status bar shows the active buffer's `LF`/`CRLF`.
File ▸ Toggle Line Endings (LF/CRLF) or `Alt+E` switches the buffer
and marks it dirty. New buffers use `:editor/eol` (`auto` = platform native, or `lf` /
`crlf`). See the guide's “Line endings” section.
### Find & Replace
| Key | Action |
|-----|--------|
| `Ctrl+/` | Open find |
| `Ctrl+H` | Open find/replace |
| `F3` | Find next match |
| `Ctrl+Shift+/` | Find selection in external panel |
| `Escape` | Exit find mode |
| `Enter` | Go to next match |
| `Tab` | Switch between find and replace fields |
| `Ctrl+Enter` | Replace all (in replace mode) |
### Type Gutter (Schema)
`.dft` buffers show a `◇` in the left gutter on every `deftype` and
`defunion` declaration. Hover it to brighten, then click it to open the
Schema app focused on that type (save the buffer first if it is dirty).
The Go menu also has Open Type in Schema for the declaration under the
cursor.
### Code Folding
| Key | Action |
|-----|--------|
| `Alt+Z` | Toggle fold at cursor |
| `Ctrl+Shift+Z` | Fold all |
| `Ctrl+Alt+Z` | Unfold all |
| `Alt+0` | Unfold all |
| `Alt+1`..`Alt+6` | Fold to heading level N (markdown) |
### Evaluation & Navigation
| Key | Action |
|-----|--------|
| `Ctrl+Enter` | Evaluate current line/selection |
| `Alt+F` | Evaluate enclosing definition |
| `Ctrl+Space` | Trigger completion |
| `F2` | Go to definition |
| `F6` | Expand selection |
| `Shift+F6` | Shrink selection |
| `Ctrl+L` | Reload target |
### Completion Overlay (visible)
| Key | Action |
|-----|--------|
| `Up` / `Down` | Navigate completions |
| `Enter` | Accept completion |
| `Escape` | Hide completions |
| `Tab` | Cycle completion tier |
### Vi Mode (`:set driver=vi` or menu Edit → Driver: vi)
Modes: NORMAL (default), INSERT (`i` `a` `I` `A` `o` `O`), VISUAL (`v`),
VISUAL-LINE (`V`); `Esc` returns to NORMAL.
Engine chords stay live in every vi mode — `Ctrl+O` file-open, `Ctrl+S`
save, `Ctrl+F` find, `Ctrl+G` goto, `Ctrl+PgUp/PgDn` buffer cycling.
Vi-owned chords: `Ctrl+D`/`Ctrl+U` half-page scroll, `Ctrl+E`/`Ctrl+Y`
one-line scroll, `Ctrl+R` redo; in insert mode `Ctrl+W`/`Ctrl+U`/`Ctrl+H`
delete word / to line start / char back.
| Key | Action |
|-----|--------|
| `h j k l` / arrows | Move (with count) |
| `w W b B e E` | Word / WORD motions |
| `f{c} F{c} t{c} T{c}` | Find char on line; `;`/`,` repeat/reverse |
| `0 ^ $` | Line start / first non-blank / end |
| `{ }` | Paragraph motions (also `d{` `y}` etc.) |
| `H M L` | Top / middle / bottom of window |
| `gg` / `G` / `{n}G` | Buffer start / end / goto line |
| `%` | Jump to matching bracket |
| `x X s S` | Delete char / char back / char / line |
| `r{c}` `~` | Replace char / toggle case (with count) |
| `d c y` + motion | Operators, doubled for line-wise (`dd` `cc` `yy`) |
| `D C Y J` | To end of line: delete / change / yank line / join |
| `df{c}` `cf{c}` ... | Operator over f/F/t/T target |
| `cw` | Change word (behaves like `ce`) |
| `p P` | Paste after / before (with count) |
| `u` `Ctrl+R` | Undo / redo |
| `.` | Repeat last change |
| `>> <<` | Indent / outdent lines (count or visual) |
| `ZZ` | Save |
| `/ ? n N * #` | Search forward/backward, repeat, word under cursor |
| `:` | Command line: `w` `wq` `x` `q` `q!` `e <path>` `set driver=` `{n}` |
| `v V o gv Esc` | Visual modes, swap ends, reselect last range |
| visual + `d x y c s r ~ J p >>` | Operate on selection |
| `za zc zo zM zR` `zz zt zb` | Folds, recenter viewport |