Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/keymap/macros.rs')
| -rw-r--r-- | helix-term/src/keymap/macros.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/helix-term/src/keymap/macros.rs b/helix-term/src/keymap/macros.rs index 9cddd825..c4a1bfbb 100644 --- a/helix-term/src/keymap/macros.rs +++ b/helix-term/src/keymap/macros.rs @@ -62,11 +62,12 @@ macro_rules! alt { }; } -/// Macro for defining a `KeyTrie`. Example: +/// Macro for defining the root of a `Keymap` object. 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" @@ -75,12 +76,12 @@ macro_rules! alt { /// }, /// "j" | "down" => move_line_down, /// }); -/// let keymap = normal_mode; +/// let keymap = Keymap::new(normal_mode); /// ``` #[macro_export] macro_rules! keymap { (@trie $cmd:ident) => { - $crate::keymap::KeyTrie::MappableCommand($crate::commands::MappableCommand::$cmd) + $crate::keymap::KeyTrie::Leaf($crate::commands::MappableCommand::$cmd) }; (@trie @@ -90,7 +91,7 @@ macro_rules! keymap { }; (@trie [$($cmd:ident),* $(,)?]) => { - $crate::keymap::KeyTrie::Sequence(vec![$($crate::commands::MappableCommand::$cmd),*]) + $crate::keymap::KeyTrie::Sequence(vec![$($crate::commands::Command::$cmd),*]) }; ( |