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: StringCurrent 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
impl KeymapManager
pub fn new() -> KeymapManager
Sourcepub fn link(&mut self, oldname: &str, newname: &str) -> bool
pub fn link(&mut self, oldname: &str, newname: &str) -> bool
Link a new name to an existing keymap
Sourcepub fn lookup_key(&self, c: char) -> Option<Thingy>
pub fn lookup_key(&self, c: char) -> Option<Thingy>
Look up a key in the current keymap
Sourcepub fn lookup_seq(&self, seq: &[u8]) -> Option<&KeyBinding>
pub fn lookup_seq(&self, seq: &[u8]) -> Option<&KeyBinding>
Look up a key sequence in the current keymap
Sourcepub fn is_prefix(&self, seq: &[u8]) -> bool
pub fn is_prefix(&self, seq: &[u8]) -> bool
Check if a sequence is a prefix in the current keymap
Sourcepub fn list_names(&self) -> Vec<&String>
pub fn list_names(&self) -> Vec<&String>
List all keymap names Port of bin_bindkey_lsmaps() from zle_keymap.c
Sourcepub fn new_keymap(&mut self, name: &str) -> bool
pub fn new_keymap(&mut self, name: &str) -> bool
Create a new empty keymap Port of newkeymap() from zle_keymap.c
Sourcepub fn copy_keymap(&mut self, src: &str, dst: &str) -> bool
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
Sourcepub fn select_local_map(&mut self, name: Option<&str>)
pub fn select_local_map(&mut self, name: Option<&str>)
Set a local keymap (temporary override) Port of selectlocalmap() from zle_keymap.c
Sourcepub fn reselect_keymap(&mut self)
pub fn reselect_keymap(&mut self)
Re-select keymap after a widget completes Port of reselectkeymap() from zle_keymap.c
Sourcepub fn read_command(&self, keys: &[u8]) -> Option<Thingy>
pub fn read_command(&self, keys: &[u8]) -> Option<Thingy>
Read a key command from the current keymap Port of readcommand() from zle_keymap.c
Sourcepub fn get_keybuf(&self) -> &[u8] ⓘ
pub fn get_keybuf(&self) -> &[u8] ⓘ
Get the key sequence from buffer Port of getkeybuf() from zle_keymap.c
Sourcepub fn add_keybuf(&mut self, c: u8)
pub fn add_keybuf(&mut self, c: u8)
Add to key buffer Port of addkeybuf() from zle_keymap.c
Sourcepub fn clear_keybuf(&mut self)
pub fn clear_keybuf(&mut self)
Clear key buffer
Sourcepub fn is_vi_insert(&self) -> bool
pub fn is_vi_insert(&self) -> bool
Check if current keymap is vi insert
Sourcepub fn get_keymap_cmd(&self, km: &Keymap, key: u8) -> Option<Thingy>
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
Sourcepub fn key_is_prefix(&self, km: &Keymap, key: u8) -> bool
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
Sourcepub fn keybind(&mut self, seq: &[u8], thingy: Thingy) -> bool
pub fn keybind(&mut self, seq: &[u8], thingy: Thingy) -> bool
Bind key in current keymap Port of keybind() from zle_keymap.c
Sourcepub fn scan_keymap(&self, name: &str) -> Vec<(Vec<u8>, String)>
pub fn scan_keymap(&self, name: &str) -> Vec<(Vec<u8>, String)>
Get bindings for listing Port of scankeymap() / scanbindlist() from zle_keymap.c
Sourcepub fn zle_set_keymap(&mut self, name: &str) -> bool
pub fn zle_set_keymap(&mut self, name: &str) -> bool
Set keymap via ZLE (zle -K) Port of zlesetkeymap() from zle_keymap.c
Sourcepub fn ref_keymap_by_name(&self, name: &str) -> Option<Arc<Keymap>>
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
Sourcepub fn init_keymaps(&mut self)
pub fn init_keymaps(&mut self)
Initialize keymaps Port of init_keymaps() from zle_keymap.c
Sourcepub fn cleanup_keymaps(&mut self)
pub fn cleanup_keymaps(&mut self)
Cleanup keymaps Port of cleanup_keymaps() from zle_keymap.c
Trait Implementations§
Source§impl Debug for KeymapManager
impl Debug for KeymapManager
Source§impl Default for KeymapManager
impl Default for KeymapManager
Source§fn default() -> KeymapManager
fn default() -> KeymapManager
Auto Trait Implementations§
impl Freeze for KeymapManager
impl RefUnwindSafe for KeymapManager
impl Send for KeymapManager
impl Sync for KeymapManager
impl Unpin for KeymapManager
impl UnsafeUnpin for KeymapManager
impl UnwindSafe for KeymapManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.