Expand description
Vim-mode engine.
Implements a command grammar of the form
Command := count? (operator count? (motion | text-object)
| motion
| insert-entry
| misc)The parser is a small state machine driven by one Input at a time.
Motions and text objects produce a [Range] (with inclusive/exclusive
/ linewise classification). A single Operator implementation
applies a range — so dw, d$, daw, and visual d all go through
the same code path.
The most recent mutating command is stored in
VimState::last_change so . can replay it.
Structs§
- Abbrev
- A single abbreviation entry (insert-mode or cmdline-mode, recursive or noremap).
- Insert
Session - Last
Visual - Saved visual-mode anchor + cursor for
gv(re-enters the last visual selection).modecarries which visual flavour to restore;anchor/cursormean different things per flavour: - Search
Prompt - Active
/or?search prompt. Text mutations drive the textarea’s live search pattern so matches highlight as the user types. - VimState
Enums§
- Abbrev
Kind - Classify a vim abbreviation lhs into its type.
- Abbrev
Trigger - Trigger kind for abbreviation expansion.
- Insert
Dir - Direction for insert-mode arrow movement.
- Insert
Entry - Insert
Reason - Last
Change - Information needed to replay a mutating change via
.. - Last
Horizontal Motion - Tracks which kind of horizontal jump was last performed so
;/,can dispatch to the correct repeat handler. - Mode
- Motion
- Operator
- Pending
- Range
Kind - Classification determines how operators treat the range end.
- Scroll
Dir - Scroll direction for
scroll_full_page,scroll_half_page, andscroll_linecontroller methods. - Text
Object
Constants§
- CHANGE_
LIST_ MAX - JUMPLIST_
MAX - Max jumplist depth. Matches vim default.
- MAX_
COUNT - Vim caps count prefixes at 999,999,999 (
:h count); mirror that cap on every value that can feed a0..countapply loop so a pathological digit stream (<20 nines>x) saturating towardusize::MAXcan’t freeze the editor. MatchesCountAccumulator::MAX_COUNTin hjkl-vim. - SEARCH_
HISTORY_ MAX
Functions§
- drop_
blame_ if_ left_ normal - Drop the
Blameview overlay whenever the input mode is no longerNormal. BLAME is a Normal-only read-only view; entering Insert/Visual/etc. (by keyboard, mouse drag, or programmatic transition) implicitly leaves it. Called from every mode-transition funnel so the FSM is the single source of truth — the host never has to police this. - install
- Install the vim discipline on
ed, replacing whatever was there. - op_
is_ change truewhenoprecords alast_changeentry for dot-repeat purposes. Promoted topubin Phase 6.6e sohjkl-vim::normalcan use it without duplicating the logic.- parse_
motion - Parse the first key of a normal/visual-mode motion. Returns
Nonefor keys that don’t start a motion (operator keys, command keys, etc.). Promoted topubin Phase 6.6e sohjkl-vim::normalcan call it. - vim_
editor - Build an
Editorwith the vim discipline already installed.