diff options
Diffstat (limited to 'docs/helix-keys.md')
| -rw-r--r-- | docs/helix-keys.md | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/docs/helix-keys.md b/docs/helix-keys.md index 86c50722..f3dd2dc3 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -20,21 +20,21 @@ injected `comment` layer) touches the editing code, and it needs tree-sitter, which the harness runs without. Code map, by SYMBOL — line numbers rot, names do not. Body-normal key -RECOGNITION is `modal.Normal` in `src/modal.zig`: a state machine over `Role` (one -per bound command, named as `src/config.zig` binds it and matched against its -chord lists by `normalInput` in `src/normal.zig`), the pending prefix and `m` +RECOGNITION is `modal.Normal` in `core/modal.zig`: a state machine over `Role` (one +per bound command, named as `core/config.zig` binds it and matched against its +chord lists by `normalInput` in `core/normal.zig`), the pending prefix and `m` sub-key (each the role of the key read) and a count, emitting an `Action`: the role and what it was given (a count, a literal, `]` or `[`). The roles are grouped by the context a key is read in and tried in their order there. The text's executor (`executeNormalAction`) and a PDF's (`pdf_view.applyNormal`) both switch on the role. It knows nothing about panes or text. Then it is -EXECUTED: `Key` and `handleKey` in `src/pardes.zig` (intercept order is +EXECUTED: `Key` and `handleKey` in `core/root.zig` (intercept order is load-bearing, see the comment there); `handleNormal` (parses directly into `Pane.normal`), `executeNormalAction`, `replaySels` and `multiOnce` in -`src/normal.zig`; and `enterInsert`, `handleInsert` / `insertKey`, `insertTab`, -`normalDelete`, `normalYank`, `pasteText`, `normalChange` in `src/edit.zig`. Undo +`core/normal.zig`; and `enterInsert`, `handleInsert` / `insertKey`, `insertTab`, +`normalDelete`, `normalYank`, `pasteText`, `normalChange` in `core/edit.zig`. Undo and redo live in `panes.File` and `panes.Terminal`. Pure text math: -`src/modal.zig` (the `hx*` family is the helix-semantics layer: gap offsets + +`core/modal.zig` (the `hx*` family is the helix-semantics layer: gap offsets + ranges over the flat text). Differential harness: `test/hxdiff.zig` + `test/hxcases/*.jsonl` — see "Differential testing" at the bottom. @@ -117,7 +117,7 @@ language-backend queries, and the shell pipe. | `zm` | scroll the unwrapped view so the cursor's column is in its middle | helix `align_view_middle`; with soft wrap on there is no horizontal scroll, and nothing happens | out of corpus (the harness's text never scrolls sideways) | | `i` `a` | insert at selection start / after selection end | helix semantics: `i` before the selection, `a` selects and appends after it | helix-verified | | `I` `A` | insert at first non-ws / line end | matches `insert_at_line_start` / `insert_at_line_end` | helix-verified | -| `o` `O` | open line below / above, with helix's indent from the syntax tree where the file's grammar has an indent query (src/indent.zig, as Enter), else the current line's indent as it is (acme's autoindent, tabs and all); `<n>o` opens n | `open_below`/`open_above`, except that helix's no-language fallback rounds the indent down to whole units: under its 4-space unit, two spaces open a line with none (waiver `o-partial-indent-drops`) | helix-verified (whole units) / pardes-specific (partial) | +| `o` `O` | open line below / above, with helix's indent from the syntax tree where the file's grammar has an indent query (core/indent.zig, as Enter), else the current line's indent as it is (acme's autoindent, tabs and all); `<n>o` opens n | `open_below`/`open_above`, except that helix's no-language fallback rounds the indent down to whole units: under its 4-space unit, two spaces open a line with none (waiver `o-partial-indent-drops`) | helix-verified (whole units) / pardes-specific (partial) | | `v` | select (extend) mode: motions extend from the fixed anchor; `v` again exits KEEPING the selection | mode "select" is reported only while this is on (helix keeps mode normal for x/%/mi selections) | helix-verified | | `x` / `<n>x` | select current line / extend one (n) line(s) down, char-range through the newline, cursor ON the `\n` | col-0 vim-ism removed (phase 5); matches `extend_line_below`, mode stays normal | helix-verified | | `d` | delete selection (implicit or explicit); bare cursor = the 1-wide selection | always yanks (`Alt-d` noyank in B); terminals: drops typed runs only | helix-verified | @@ -137,11 +137,11 @@ language-backend queries, and the shell pipe. | `Space` (normal, body) | starts the pardes LEADER: a key path runs the same builtin words used by tags and the topbar. The main groups are `f` files, `h` docs, `c` columns, `t` toggles/effects, `a` panel animations, `s` session, `j` jumps, `l` language, and `w` directional focus; `SPC ?` lists every path and `<prefix> ?` lists one group in `+Help`. Neither `Exit` (quits the editor, acme's Exit) nor `Kill` (stops the commands pardes typed into terminals, acme's Kill) has a leader path: both are the topbar's and the root `ctl`'s. The pending path appears on the active pane's transient body/message row. Esc or an unmapped key abandons it. Paths, Help rows, and dispatch are all generated from the builtin registry at comptime; the leader applies only to a BODY in normal mode because tags and tty programs own their input | pardes-specific; helix spends Space on pickers/LSP (section C), while pardes uses acme-style executable words | | `SPC y` `SPC Y` `SPC p` `SPC P` `SPC R` | helix's clipboard menu on helix's own letters: yank the selection to the system clipboard (`ClipYank`) or the PRIMARY selection alone (`ClipYankMain`), paste the system clipboard after (`ClipPaste`) / before (`ClipPasteBefore`) the selection, replace the selection with it (`ClipReplace`) | the same as `"+y`, `"+p`, `"+P`, `"+R`: register `+` (and `*`) IS the desktop's clipboard, the only register that reaches it. `SPC y` writes `+` alone, as helix's does, not the default register too. Builtins rather than bare chords because a leader path names a builtin: they land in Help's index and are executable words like every other verb. The clipboard holds one text, so N values go out joined by newlines, as helix sends them. On a tty the write is OSC 52 out and the READ is OSC 52 back, which many terminals refuse or gate — so `SPC y` works there and `SPC p` can be a no-op | out of corpus | | a paste from the OUTER terminal | one `Event.paste`, spliced in at the cursor | the tui shell enables bracketed paste and coalesces `paste_start`..`paste_end` into a single event; before that the bytes arrived as individual key presses and normal mode RAN them, which is how a pasted `d` deleted a line. The bytes deliberately never enter the yank register — clipboard and default register are separate stores in both directions | pardes-specific | -| `/` (a text) | a query pane under the pane (`src/Query.zig`): a `+Search` whose line 1 is the query, typed into; helix's regex with smart case, every match tinted and ticked on the rail as you type (the pane's places, `src/Places.zig`), the first after the cursor selected (helix's incremental preview). `Ctrl-n`/`Ctrl-p` step while typing; Enter lands, fills `/` and keeps the rows as text; Esc while typing restores the text and closes the pane. Line 1's first word names the source (`/`, `Find`, `Grep`, `Recent`, `Panes`, `Symbols`, `All`, `Refs`, `Def`, `Impl`, `Diagnostics`), helix's pickers as one pane. A terminal's and a PDF's `/` keep the notice-band prompt and its `+Search` | helix's `/` semantics (regex, smart case, preview); the pane is pardes' | pardes-specific | +| `/` (a text) | a query pane under the pane (`core/Query.zig`): a `+Search` whose line 1 is the query, typed into; helix's regex with smart case, every match tinted and ticked on the rail as you type (the pane's places, `core/Places.zig`), the first after the cursor selected (helix's incremental preview). `Ctrl-n`/`Ctrl-p` step while typing; Enter lands, fills `/` and keeps the rows as text; Esc while typing restores the text and closes the pane. Line 1's first word names the source (`/`, `Find`, `Grep`, `Recent`, `Panes`, `Symbols`, `All`, `Refs`, `Def`, `Impl`, `Diagnostics`), helix's pickers as one pane. A terminal's and a PDF's `/` keep the notice-band prompt and its `+Search` | helix's `/` semantics (regex, smart case, preview); the pane is pardes' | pardes-specific | | `n` / `N` | next / previous match of the text's places when a query pane fed them (a `/`, a list's places in this text: refs, diagnostics, a Grep's hits), round the ends without a message; else the last search register's regex in the current text, as before; counts repeat | only the primary selection is replaced; in select mode each match is added and becomes primary. Named registers work. `*` sets the pattern from selections with word boundaries (`Alt-*` without) and seeds the text's query pane with it, the keyboard staying. The former Look ring is `LookNext` / `LookPrev`, `SPC j n` / `SPC j p`. PDFs retain their location-result navigation | helix-verified | | insert: printable text | file: real edit; terminal: typed run splice | | helix-verified (file) | -| insert: `Enter` | newline; where the file's grammar has an indent query (vendor/queries/*/indents.scm), helix's `indent_for_newline` over the syntax tree (src/indent.zig, the reference's containment engine, `hybrid` heuristic); else keeps the current line's indent as it is and adds one 4-space logical tab (a tab where the indent is tabs) when the text before the cursor ends in `(`, `[`, `{`, or `)` (including `})`). Between a pair (helix's default auto-pairs) the closer gets a line of its own at that indent and the cursor one a level in (`insert_newline`'s `on_auto_pair`) | plain lines match `insert_newline` at whole indent units (helix drops a partial one, as for `o`); delimiter heuristic is pardes-specific; with a grammar, `test/hxcases/indent.jsonl` against the reference `hx` and its grammars (`hx_indent.py`) | helix-verified (plain, grammar) / pardes-specific (partial indent, delimiter) | +| insert: `Enter` | newline; where the file's grammar has an indent query (vendor/queries/*/indents.scm), helix's `indent_for_newline` over the syntax tree (core/indent.zig, the reference's containment engine, `hybrid` heuristic); else keeps the current line's indent as it is and adds one 4-space logical tab (a tab where the indent is tabs) when the text before the cursor ends in `(`, `[`, `{`, or `)` (including `})`). Between a pair (helix's default auto-pairs) the closer gets a line of its own at that indent and the cursor one a level in (`insert_newline`'s `on_auto_pair`) | plain lines match `insert_newline` at whole indent units (helix drops a partial one, as for `o`); delimiter heuristic is pardes-specific; with a grammar, `test/hxcases/indent.jsonl` against the reference `hx` and its grammars (`hx_indent.py`) | helix-verified (plain, grammar) / pardes-specific (partial indent, delimiter) | | insert: `Backspace` (+ `Shift-Backspace`) | delete prev char, joins lines at col 0; in a line's leading blanks, back to the previous 4-column indent stop (a whole unit when on one; a tab still goes alone) | matches `delete_char_backward` and its dedent; `Ctrl-h` alias in B | helix-verified | | insert: `Up` `Down` `Left` `Right` | move cursor | matches helix's "not recommended" insert arrows | helix-verified | | `gd` `gD` `gy` `gi` `gr` | LSP definition / declaration / type-definition / implementation / references. One answer jumps straight there; several (definition, implementation, references) fill the text's query pane, line 1 `Def`/`Impl`/`Refs`, their places in the text tinted and stepped by `n`/`N`; the others fill `+Search`, where `LookNext` / `LookPrev` walk and Enter opens | Ctrl+left-click is the mouse spelling of `gd`; language support depends on the configured backend | out of corpus | @@ -271,7 +271,7 @@ with what is on screen. Pressed in a tag, column tag or workspace tag they select in that tag's own text, and so does `|` pipe it; `/` searches the body wherever it is pressed (`Pane.prompt_for`). Engine: **mvzr** (`build.zig.zon`), a bytecode VM that compiles a runtime pattern with no allocator, called the way sam searches -(`src/regexp.zig`, shared with a pane's `addr` file): each line is its own +(`core/regexp.zig`, shared with a pane's `addr` file): each line is its own haystack, so `^` and `$` match at every line's start and end and `.` never crosses a newline, and a pattern naming `\n` runs over the whole selection. Where helix's `^` is only the selection's start, this is sam's. mvzr @@ -285,8 +285,8 @@ keeps the matches it found so far. | `S<pat>` Enter | split each range on its matches | helix `split_on_matches`; the pieces BETWEEN the matches, including the empty one a leading match produces | helix-verified | | `s`/`S` then Esc | back to the selection the prompt opened on | the empty pattern applies nothing, so cancelling IS the restore — one path, not a second one | helix-verified | | an all-lowercase pattern | matches case-blind | helix's smart-case. mvzr has no such flag, so the surface is lowercased instead (ASCII folding is byte-for-byte, so the offsets are identical) | helix-verified | -| `^` and `$` | hold at every line's start and end | helix compiles with `multi_line(true)`; pardes gets the same by searching each line as its own haystack (`src/regexp.zig`) | helix-verified | -| `.` | never matches a newline | as the Rust regex crate: a pattern without `\n` searches line by line, and one that names `\n` has its `.`s made `[^\n]` (`src/regexp.zig`) | helix-verified | +| `^` and `$` | hold at every line's start and end | helix compiles with `multi_line(true)`; pardes gets the same by searching each line as its own haystack (`core/regexp.zig`) | helix-verified | +| `.` | never matches a newline | as the Rust regex crate: a pattern without `\n` searches line by line, and one that names `\n` has its `.`s made `[^\n]` (`core/regexp.zig`) | helix-verified | | `\s`, `[^...]` | never match a newline unless the pattern names `\n` | the same line-by-line search; helix's `\s` and negated classes do match one, so its `S\s+` also splits at every newline, the last line's too, where pardes keeps a newline inside its piece unless the pattern is `\s+\|\n` (waivers `split-regex-ws`, `split-regex-ws-tty`) | pardes-specific | | many matches | up to `memory.limits.selections` ranges, 1024; matches past it are dropped | helix has no limit. The room for them is allocated when a second range appears and given back at one range, so a single cursor costs nothing | helix-verified up to the limit | | `K<pat>` / `Alt-K<pat>` Enter | keep only the ranges a match starts inside / only those none does; primary 0, and keeping none leaves the selection alone | helix `keep_selections` / `remove_selections`, on the same prompt as `s`/`S` (markers `Keep /`, `Remove /`). The range is searched as `s` searches it, line by line with its lines' context, where helix matches the range's text alone: a `^` right at a range that starts mid-line matches in helix and not here | helix-verified | @@ -300,7 +300,7 @@ keeps the matches it found so far. | … with mixed indents | the token goes in at the SHALLOWEST indent in the set | helix's `min`, quirks included: a deeper line is commented mid-whitespace | helix-verified | | … uncommenting | one space after the token goes too, unless some line lacks it | helix's `margin` | helix-verified | | … blank lines | skipped entirely, and they do not vote on commented-or-not | helix | helix-verified | -| which token | by file EXTENSION, from `config.comment_tokens` | the same notion of "language" `src/syntax.zig` picks grammars with. No extension (a terminal, an output buffer) or an unlisted one gets `config.comment_token_default` = `#`, which is helix's own `DEFAULT_COMMENT_TOKEN` and therefore what the oracle answers | helix-verified | +| which token | by file EXTENSION, from `config.comment_tokens` | the same notion of "language" `core/syntax.zig` picks grammars with. No extension (a terminal, an output buffer) or an unlisted one gets `config.comment_token_default` = `#`, which is helix's own `DEFAULT_COMMENT_TOKEN` and therefore what the oracle answers | helix-verified | | block comments (`/* */`) | **skipped**: helix only reaches them when a language declares block tokens and no line tokens; every language in the table has a line comment | ### Match mode (`m` prefix) — plain-text, no tree-sitter |
