#989 and #1016 went after multi-key bindings so the combined design lives here.
Storage : a trie in Keybindings keyed by KeyCombination, as in feat: add initial support for multi-stroke chord keybindings in emacs mode #989 .
A key may be both a binding and a prefix (j -> Down, jj -> Esc).
Recogniser : one SequenceResolver in edit_mode that each mode embeds, as in feat: Allow for user-defined "chord" / multi-key keybindings (and correct vi motions when targeting <space> char) #1016 but written once.
The mode only supplies the fallback, e.g. vi insert self-inserts a lone j once the sequence dies.
Timeout : the pending sequence flushes on the engine side, since only the engine sees time pass.
Tests : through the vi harness, an emacs counterpart, and the four cases: completes, times out, strict prefix, binding-and-prefix.
Config shape on the nushell side and f<char> style capture are follow-ups.
Thanks @reubeno and @benvansleen for the two halves.
#989 and #1016 went after multi-key bindings so the combined design lives here.
Keybindingskeyed byKeyCombination, as in feat: add initial support for multi-stroke chord keybindings in emacs mode #989.A key may be both a binding and a prefix (
j->Down,jj->Esc).SequenceResolverinedit_modethat each mode embeds, as in feat: Allow for user-defined "chord" / multi-key keybindings (and correctvimotions when targeting <space> char) #1016 but written once.The mode only supplies the fallback, e.g. vi insert self-inserts a lone
jonce the sequence dies.Config shape on the nushell side and
f<char>style capture are follow-ups.Thanks @reubeno and @benvansleen for the two halves.