pub struct Keymap { /* private fields */ }Implementations§
Source§impl Keymap
impl Keymap
pub fn new() -> Self
pub fn default_vim() -> Self
pub fn bind( &mut self, mode: Mode, key: Key, action: Action, desc: impl Into<String>, )
pub fn lookup(&self, mode: Mode, key: &Key) -> Option<&Binding>
Sourcepub fn leader(&self) -> &Key
pub fn leader(&self) -> &Key
The leader key — what <leader> resolves to when a sequence
binding is applied. Defaults to , (blnvim parity).
Sourcepub fn set_leader(&mut self, key: Key)
pub fn set_leader(&mut self, key: Key)
Override the leader key. Applied before sequence bindings so
<leader>-prefixed specs resolve against the chosen prefix.
Sourcepub fn bind_sequence(
&mut self,
mode: Mode,
keys: Vec<Key>,
action: Action,
desc: impl Into<String>,
)
pub fn bind_sequence( &mut self, mode: Mode, keys: Vec<Key>, action: Action, desc: impl Into<String>, )
Bind a multi-key SEQUENCE — <leader>ff →
[Char(','), Char('f'), Char('f')], gg →
[Char('g'), Char('g')]. A length-1 sequence delegates to
bind so callers never special-case it; an
empty sequence is a no-op.
Sourcepub fn lookup_sequence(&self, mode: Mode, keys: &[Key]) -> Option<&Binding>
pub fn lookup_sequence(&self, mode: Mode, keys: &[Key]) -> Option<&Binding>
Exact-match lookup for a full key sequence.
Sourcepub fn is_sequence_prefix(&self, mode: Mode, prefix: &[Key]) -> bool
pub fn is_sequence_prefix(&self, mode: Mode, prefix: &[Key]) -> bool
Does any bound sequence in mode STRICTLY extend prefix
(i.e. prefix is a proper prefix of a longer bound sequence)?
Drives the runtime’s pending-stroke state: a partial sequence
that is still a live prefix is held pending rather than
dispatched. Linear scan — fine at fleet sequence counts; a
trie is a later optimization if profiling ever asks for it.
Sourcepub fn sequence_len(&self) -> usize
pub fn sequence_len(&self) -> usize
Count of bound multi-key sequences — for --keymap / doctor.