aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/keymap.rs
diff options
context:
space:
mode:
authorLinden Krouse2024-05-01 20:48:08 +0000
committerJJ2024-05-01 23:06:27 +0000
commit0a08d7eb5e5049dee8804dffcb110d7d27503810 (patch)
tree9d0a565114788738e1bfa125faaa842ce57f4d9d /helix-term/src/keymap.rs
parent3bff36ab90aba7de8bb5bff7dbb8230d81cdf582 (diff)
Add unbind-default-keys config option
ref: https://github.com/helix-editor/helix/issues/2720 ref: https://github.com/helix-editor/helix/pull/2733
Diffstat (limited to 'helix-term/src/keymap.rs')
-rw-r--r--helix-term/src/keymap.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index 975274ed..995e3c41 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -318,7 +318,10 @@ impl Keymaps {
pub fn get(&mut self, mode: Mode, key: KeyEvent) -> KeymapResult {
// TODO: remove the sticky part and look up manually
let keymaps = &*self.map();
- let keymap = &keymaps[&mode];
+ let keymap = match keymaps.get(&mode) {
+ Some(keymap) => keymap,
+ None => return KeymapResult::NotFound,
+ };
if key!(Esc) == key {
if !self.state.is_empty() {
@@ -373,7 +376,7 @@ impl Default for Keymaps {
}
}
-/// Merge default config keys with user overwritten keys for custom user config.
+/// Merge existing config keys with user overwritten keys.
pub fn merge_keys(dst: &mut HashMap<Mode, KeyTrie>, mut delta: HashMap<Mode, KeyTrie>) {
for (mode, keys) in dst {
keys.merge_nodes(