Expand description
Static keymap catalog + keymap_entry! macro (DESIGN.md §5.2.3).
K.3 (2026-06-07): moved from lattice-mode::keymap_entry into
lattice-keymap so the trie, KeymapLayer, and resolve_trace
can reference the entry type without a dep cycle back to
lattice-mode.
lattice-mode::keymap_entry is retained as a re-export shim.
lattice-host::keymap and lattice-ui-tui continue to re-export
the macro and entry type unchanged.
§Construction
KeymapEntry keeps its source field private; the
keymap_entry! macro is the only intended construction path,
and the macro calls the #[doc(hidden)] KeymapEntry::__new
constructor to populate it. External crates that try to build a
literal directly fail at the privacy boundary — preserving the
forgery-prevention discipline from DESIGN.md §5.11.1 (source is
captured at the row’s own file!() + line!(), not supplied
ad-hoc).
Notation:
- Plain chars:
j,dw,gg. - Modifier-prefixed:
<C-d>,<C-v>,<C-r>. - Special keys:
<Esc>,<CR>,<Tab>,<Up>,<Down>,<Left>,<Right>,<Home>,<End>,<PageUp>,<PageDown>,<BS>. - Multi-key sequences are concatenated:
gg,dw,zt.
Structs§
- Keymap
Entry - One row in the catalog. Ordering of fields matches the rendering
order in
:describe-keyso reading one field at a time still tells a coherent story.
Functions§
- default_
keymap - Borrow the full vim default keymap. Lazily initialised on first
call (the entries embed
SourceLocations which carryPathBufs and therefore can’t live in astatic). - entries
- Every entry of the built-in catalog in mode-grouped declaration order —
identical to
default_keymap. Used by:keymap. - lookup
- Every row of the built-in
default_keymapwhoseKeymapEntry::chordstring equalschordexactly — across all modes, in table order. The match is on the notation string, case-sensitively, with no chord parsing or normalisation. Used by:describe-key.