Skip to main content

Module key

Module key 

Source
Expand description

Vim-notation key parser.

Parses strings like <C-w>v, gT, <leader>fa, <C-S-Tab> into a list of KeyChords the page-mode dispatcher can match against.

Notation supported:

  • <C-...> — Ctrl
  • <S-...> — Shift (also implied by uppercase ASCII letters when bare)
  • <M-...> / <A-...> — Alt / Meta
  • <D-...> — Super (Cmd on macOS)
  • <leader> — abstract placeholder; resolution to a concrete char happens at trie-build time, not here.
  • <Space>, <Esc>, <CR> / <Enter>, <BS> / <Backspace>, <Tab>, <S-Tab> / <BackTab>, <Up>, <Down>, <Left>, <Right>, <Home>, <End>, <PageUp>, <PageDown>, <Insert>, <Delete>, <F1><F12>
  • Bare characters, including punctuation: g, T, ,, ;, :, /, ?, < (escaped as <lt>).

Whitespace in the input is ignored. Empty input yields an empty Vec. Embedded literals like Hello parse as five separate chords (one per char) — this parser is not a string-mode parser.

Structs§

KeyChord
One position in a chord sequence.
Modifiers
Modifier set for one KeyChord.

Enums§

Key
What was pressed.
NamedKey
ParseError

Functions§

parse_key
Parse exactly one chord. Errors if the input parses to zero chords or more than one.
parse_keys
Parse input into a sequence of KeyChords.