Skip to main content

KeymapManager

Struct KeymapManager 

Source
pub struct KeymapManager {
    pub keymaps: HashMap<String, Arc<Keymap>>,
    pub current: Option<Arc<Keymap>>,
    pub current_name: String,
    pub local: Option<Arc<Keymap>>,
    pub keybuf: Vec<u8>,
    pub lastnamed: Option<Thingy>,
}
Expand description

Manager for all keymaps

Fields§

§keymaps: HashMap<String, Arc<Keymap>>

Named keymaps

§current: Option<Arc<Keymap>>

Current keymap

§current_name: String

Current keymap name

§local: Option<Arc<Keymap>>

Local keymap (temporary override)

§keybuf: Vec<u8>

Key sequence buffer

§lastnamed: Option<Thingy>

Last named command executed

Implementations§

Source§

impl KeymapManager

Source

pub fn new() -> KeymapManager

Source

pub fn get(&self, name: &str) -> Option<Arc<Keymap>>

Get a keymap by name

Source

pub fn select(&mut self, name: &str) -> bool

Set the current keymap

Link a new name to an existing keymap

Source

pub fn delete(&mut self, name: &str) -> bool

Delete a keymap name

Source

pub fn lookup_key(&self, c: char) -> Option<Thingy>

Look up a key in the current keymap

Source

pub fn lookup_seq(&self, seq: &[u8]) -> Option<&KeyBinding>

Look up a key sequence in the current keymap

Source

pub fn is_prefix(&self, seq: &[u8]) -> bool

Check if a sequence is a prefix in the current keymap

Source

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

List all keymap names Port of bin_bindkey_lsmaps() from zle_keymap.c

Source

pub fn new_keymap(&mut self, name: &str) -> bool

Create a new empty keymap Port of newkeymap() from zle_keymap.c

Source

pub fn copy_keymap(&mut self, src: &str, dst: &str) -> bool

Copy a keymap to a new name Port of copyto from bin_bindkey_new

Source

pub fn select_local_map(&mut self, name: Option<&str>)

Set a local keymap (temporary override) Port of selectlocalmap() from zle_keymap.c

Source

pub fn reselect_keymap(&mut self)

Re-select keymap after a widget completes Port of reselectkeymap() from zle_keymap.c

Source

pub fn read_command(&self, keys: &[u8]) -> Option<Thingy>

Read a key command from the current keymap Port of readcommand() from zle_keymap.c

Source

pub fn get_keybuf(&self) -> &[u8]

Get the key sequence from buffer Port of getkeybuf() from zle_keymap.c

Source

pub fn add_keybuf(&mut self, c: u8)

Add to key buffer Port of addkeybuf() from zle_keymap.c

Source

pub fn clear_keybuf(&mut self)

Clear key buffer

Source

pub fn is_emacs(&self) -> bool

Check if current keymap is emacs

Source

pub fn is_vi_insert(&self) -> bool

Check if current keymap is vi insert

Source

pub fn is_vi_cmd(&self) -> bool

Check if current keymap is vi command

Source

pub fn get_keymap_cmd(&self, km: &Keymap, key: u8) -> Option<Thingy>

Get keymap command for a key Port of getkeymapcmd() from zle_keymap.c

Source

pub fn key_is_prefix(&self, km: &Keymap, key: u8) -> bool

Check if key is prefix in keymap Port of keyisprefix() from zle_keymap.c

Source

pub fn keybind(&mut self, seq: &[u8], thingy: Thingy) -> bool

Bind key in current keymap Port of keybind() from zle_keymap.c

Source

pub fn keyunbind(&mut self, seq: &[u8]) -> bool

Unbind key in current keymap

Source

pub fn scan_keymap(&self, name: &str) -> Vec<(Vec<u8>, String)>

Get bindings for listing Port of scankeymap() / scanbindlist() from zle_keymap.c

Source

pub fn zle_set_keymap(&mut self, name: &str) -> bool

Set keymap via ZLE (zle -K) Port of zlesetkeymap() from zle_keymap.c

Source

pub fn ref_keymap_by_name(&self, name: &str) -> Option<Arc<Keymap>>

Reference keymap by name Port of refkeymap_by_name() from zle_keymap.c

Source

pub fn init_keymaps(&mut self)

Initialize keymaps Port of init_keymaps() from zle_keymap.c

Source

pub fn cleanup_keymaps(&mut self)

Cleanup keymaps Port of cleanup_keymaps() from zle_keymap.c

Trait Implementations§

Source§

impl Debug for KeymapManager

Source§

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

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

impl Default for KeymapManager

Source§

fn default() -> KeymapManager

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> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more