Skip to main content

Keymap

Struct Keymap 

Source
pub struct Keymap {
    pub index: Vec<(KeyPattern, Function)>,
    pub pager: Vec<(KeyPattern, PagerAction)>,
    pub macros_index: Vec<(KeyPattern, Vec<KeyEvent>, String)>,
    pub macros_pager: Vec<(KeyPattern, Vec<KeyEvent>, String)>,
}

Fields§

§index: Vec<(KeyPattern, Function)>§pager: Vec<(KeyPattern, PagerAction)>§macros_index: Vec<(KeyPattern, Vec<KeyEvent>, String)>

Macros: trigger → (replayed events, the sequence as written, kept for the help screen). Checked before the action bindings, so a macro shadows a binding on the same key (like mutt).

§macros_pager: Vec<(KeyPattern, Vec<KeyEvent>, String)>

Implementations§

Source§

impl Keymap

Source

pub fn with_config( index_over: &HashMap<String, String>, pager_over: &HashMap<String, String>, macros_index: &HashMap<String, String>, macros_pager: &HashMap<String, String>, ) -> (Keymap, Vec<String>)

Defaults with config remaps applied: a remap unbinds the action’s default keys and whatever the new key was bound to. Macros come from [macros.index]/[macros.pager], key = "sequence".

Source

pub fn lookup_index_macro(&self, key: &KeyEvent) -> Option<&[KeyEvent]>

The macro sequence bound to this key, if any.

Source

pub fn lookup_pager_macro(&self, key: &KeyEvent) -> Option<&[KeyEvent]>

Source

pub fn lookup_index(&self, key: &KeyEvent) -> Option<Function>

Source

pub fn lookup_pager(&self, key: &KeyEvent) -> Option<PagerAction>

Source

pub fn help_lines(&self) -> Vec<String>

Lines for the help screen, grouped and ordered by action.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.