aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/config.rs
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-26 18:19:10 +0000
committerNathan Vegdahl2021-07-26 18:19:10 +0000
commitf62ec6e51e99dce9e93600801c3637c196c592b6 (patch)
tree8821ee23ade21c0da4fbb5a70143717ac42a2bc1 /helix-term/src/config.rs
parent5ee6ba5b38ebeb86006bb2e42734a2285eb354df (diff)
parent88d6f652390922b389667f469b6d308db569bdaf (diff)
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Diffstat (limited to 'helix-term/src/config.rs')
-rw-r--r--helix-term/src/config.rs34
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()
}