diff options
Diffstat (limited to 'helix-term/src/config.rs')
-rw-r--r-- | helix-term/src/config.rs | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/helix-term/src/config.rs b/helix-term/src/config.rs index b5ccbdfb..f3f0ba53 100644 --- a/helix-term/src/config.rs +++ b/helix-term/src/config.rs @@ -2,9 +2,6 @@ use serde::Deserialize; use crate::keymap::Keymaps; -#[cfg(test)] -use crate::commands::Command; - #[derive(Debug, Default, Clone, PartialEq, Deserialize)] pub struct Config { pub theme: Option<String>, @@ -22,12 +19,10 @@ pub struct LspConfig { #[test] fn parsing_keymaps_config_file() { + use crate::keymap; + use crate::keymap::Keymap; use helix_core::hashmap; - use helix_view::{ - document::Mode, - input::KeyEvent, - keyboard::{KeyCode, KeyModifiers}, - }; + use helix_view::document::Mode; let sample_keymaps = r#" [keys.insert] @@ -42,22 +37,13 @@ fn parsing_keymaps_config_file() { toml::from_str::<Config>(sample_keymaps).unwrap(), Config { keys: Keymaps(hashmap! { - Mode::Insert => hashmap! { - KeyEvent { - code: KeyCode::Char('y'), - modifiers: KeyModifiers::NONE, - } => Command::move_line_down, - KeyEvent { - code: KeyCode::Char('a'), - modifiers: KeyModifiers::SHIFT | KeyModifiers::CONTROL, - } => Command::delete_selection, - }, - Mode::Normal => hashmap! { - KeyEvent { - code: KeyCode::F(12), - modifiers: KeyModifiers::ALT, - } => Command::move_next_word_end, - }, + Mode::Insert => Keymap::new(keymap!({ "Insert mode" + "y" => move_line_down, + "S-C-a" => delete_selection, + })), + Mode::Normal => Keymap::new(keymap!({ "Normal mode" + "A-F12" => move_next_word_end, + })), }), ..Default::default() } |