Guide API
Skip to main content

Module keymap

Module keymap 

Source
Expand description

Data-driven, process-global keymap shared by the editor and input line.

Models the VS Code keybindings shape — a chord (1–2 keystrokes) maps to a Command by name. Generalizes the C++ editor’s firstKeys/quickKeys/ blockKeys tables and key_state prefix machine. See docs/superpowers/specs/2026-06-12-configurable-keymap-design.md.

Guide: Keyboard & key mapping.

§Turbo Vision heritage

tvision-rs extension: no Turbo Vision counterpart. The C++ editor hard-codes its keys in the firstKeys / quickKeys / blockKeys tables; Keymap::word_star transcribes them.

Structs§

Chord
A chord: one keystroke, or two for a prefix sequence (Ctrl-K / Ctrl-Q style).
KeyStroke
One normalized keystroke: a Key plus the three real modifiers.
Keymap
A Chord → Command table plus the set of strokes that begin a 2-chord.

Enums§

Resolve
The outcome of resolving a keystroke against a keymap.

Functions§

parse_chord
Parse a VS Code-style chord string: space-separated strokes, each a +-joined list of ctrl|shift|alt|cmd|meta modifiers ending in a key name. Pure (no I/O). cmd/meta are accepted as aliases for ctrl (portability).
resolve_global
Resolve a stroke against the process-global keymap.
set_global
Replace the process-global keymap (the default for all text input).