summaryrefslogtreecommitdiff
path: root/helix-term/src/keymap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/keymap.rs')
-rw-r--r--helix-term/src/keymap.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index db958833..59204889 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -208,18 +208,17 @@ pub struct Keymap {
root: KeyTrie,
}
+/// A map of command names to keybinds that will execute the command.
+pub type ReverseKeymap = HashMap<String, Vec<Vec<KeyEvent>>>;
+
impl Keymap {
pub fn new(root: KeyTrie) -> Self {
Keymap { root }
}
- pub fn reverse_map(&self) -> HashMap<String, Vec<Vec<KeyEvent>>> {
+ pub fn reverse_map(&self) -> ReverseKeymap {
// recursively visit all nodes in keymap
- fn map_node(
- cmd_map: &mut HashMap<String, Vec<Vec<KeyEvent>>>,
- node: &KeyTrie,
- keys: &mut Vec<KeyEvent>,
- ) {
+ fn map_node(cmd_map: &mut ReverseKeymap, node: &KeyTrie, keys: &mut Vec<KeyEvent>) {
match node {
KeyTrie::Leaf(cmd) => match cmd {
MappableCommand::Typable { name, .. } => {