Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multi key remappings in config file #454

Merged
merged 18 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions helix-term/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub struct LspConfig {

#[test]
fn parsing_keymaps_config_file() {
use crate::keymap::{KeyTrie, Keymap};
use helix_core::hashmap;
use helix_view::{
document::Mode,
Expand All @@ -42,22 +43,22 @@ fn parsing_keymaps_config_file() {
toml::from_str::<Config>(sample_keymaps).unwrap(),
Config {
keys: Keymaps(hashmap! {
Mode::Insert => hashmap! {
Mode::Insert => Keymap::new(hashmap! {
sudormrfbin marked this conversation as resolved.
Show resolved Hide resolved
KeyEvent {
code: KeyCode::Char('y'),
modifiers: KeyModifiers::NONE,
} => Command::move_line_down,
} => KeyTrie::Leaf(Command::move_line_down),
KeyEvent {
code: KeyCode::Char('a'),
modifiers: KeyModifiers::SHIFT | KeyModifiers::CONTROL,
} => Command::delete_selection,
},
Mode::Normal => hashmap! {
} => KeyTrie::Leaf(Command::delete_selection),
}),
Mode::Normal => Keymap::new(hashmap! {
KeyEvent {
code: KeyCode::F(12),
modifiers: KeyModifiers::ALT,
} => Command::move_next_word_end,
},
} => KeyTrie::Leaf(Command::move_next_word_end),
}),
}),
..Default::default()
}
Expand Down
Loading