Skip to main content

Keymap

Struct Keymap 

Source
pub struct Keymap { /* private fields */ }

Implementations§

Source§

impl Keymap

Source

pub fn new() -> Self

Source

pub fn default_vim() -> Self

Source

pub fn bind( &mut self, mode: Mode, key: Key, action: Action, desc: impl Into<String>, )

Source

pub fn lookup(&self, mode: Mode, key: &Key) -> Option<&Binding>

Source

pub fn leader(&self) -> &Key

The leader key — what <leader> resolves to when a sequence binding is applied. Defaults to , (blnvim parity).

Source

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.

Source

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.

Source

pub fn lookup_sequence(&self, mode: Mode, keys: &[Key]) -> Option<&Binding>

Exact-match lookup for a full key sequence.

Source

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.

Source

pub fn sequence_len(&self) -> usize

Count of bound multi-key sequences — for --keymap / doctor.

Source

pub fn dispatch(&self, state: &ModalState, key: &Key) -> CountedAction

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn entries_sorted(&self) -> Vec<(&Mode, &Key, &Binding)>

Sorted view over every binding — for escriba --keymap and palettes.

Trait Implementations§

Source§

impl Clone for Keymap

Source§

fn clone(&self) -> Keymap

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Keymap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Keymap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.