aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/keymap
diff options
context:
space:
mode:
authorgibbz002023-06-03 09:29:08 +0000
committerBlaž Hrastnik2023-06-07 01:11:13 +0000
commit9926c2d292712f38615cc2cb0ca75c1e8ef3bed9 (patch)
tree3391ea1985ccc0d70c2054f98a44d52450485d43 /helix-term/src/keymap
parentb8563685ec44fd6958514f478d879ba785e916ad (diff)
Remove Keymap(KeyTrie) and simply use KeyTrie.
Diffstat (limited to 'helix-term/src/keymap')
-rw-r--r--helix-term/src/keymap/default.rs10
-rw-r--r--helix-term/src/keymap/macros.rs5
2 files changed, 7 insertions, 8 deletions
diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs
index d80ab1ff..c84c616c 100644
--- a/helix-term/src/keymap/default.rs
+++ b/helix-term/src/keymap/default.rs
@@ -1,10 +1,10 @@
use std::collections::HashMap;
use super::macros::keymap;
-use super::{Keymap, Mode};
+use super::{KeyTrie, Mode};
use helix_core::hashmap;
-pub fn default() -> HashMap<Mode, Keymap> {
+pub fn default() -> HashMap<Mode, KeyTrie> {
let normal = keymap!({ "Normal mode"
"h" | "left" => move_char_left,
"j" | "down" => move_visual_line_down,
@@ -380,8 +380,8 @@ pub fn default() -> HashMap<Mode, Keymap> {
"end" => goto_line_end_newline,
});
hashmap!(
- Mode::Normal => Keymap::new(normal),
- Mode::Select => Keymap::new(select),
- Mode::Insert => Keymap::new(insert),
+ Mode::Normal => normal,
+ Mode::Select => select,
+ Mode::Insert => insert,
)
}
diff --git a/helix-term/src/keymap/macros.rs b/helix-term/src/keymap/macros.rs
index b2822069..15d2aa53 100644
--- a/helix-term/src/keymap/macros.rs
+++ b/helix-term/src/keymap/macros.rs
@@ -62,12 +62,11 @@ macro_rules! alt {
};
}
-/// Macro for defining the root of a `Keymap` object. Example:
+/// Macro for defining a `KeyTrie`. Example:
///
/// ```
/// # use helix_core::hashmap;
/// # use helix_term::keymap;
-/// # use helix_term::keymap::Keymap;
/// let normal_mode = keymap!({ "Normal mode"
/// "i" => insert_mode,
/// "g" => { "Goto"
@@ -76,7 +75,7 @@ macro_rules! alt {
/// },
/// "j" | "down" => move_line_down,
/// });
-/// let keymap = Keymap::new(normal_mode);
+/// let keymap = normal_mode;
/// ```
#[macro_export]
macro_rules! keymap {