diff options
author | Blaž Hrastnik | 2020-10-22 05:35:07 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-12-03 04:10:35 +0000 |
commit | b39849dde1b1277d14dbc4e2e1604e5d020db43d (patch) | |
tree | c247d4f605db00248eaa0a4383c5ec65db5f69cc /helix-view/src/keymap.rs | |
parent | 81ccca0c6a18de86223b8142b5742e0603b9b230 (diff) |
Refactor: Document type as a wrapper around barebones State.
Diffstat (limited to 'helix-view/src/keymap.rs')
-rw-r--r-- | helix-view/src/keymap.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/helix-view/src/keymap.rs b/helix-view/src/keymap.rs index 82bdbe21..347e7d77 100644 --- a/helix-view/src/keymap.rs +++ b/helix-view/src/keymap.rs @@ -1,4 +1,5 @@ use crate::commands::{self, Command}; +use crate::document::Mode; use helix_core::{hashmap, state}; use std::collections::HashMap; @@ -88,7 +89,7 @@ pub use crossterm::event::{KeyCode, KeyEvent as Key, KeyModifiers as Modifiers}; // TODO: could be trie based pub type Keymap = HashMap<Vec<Key>, Command>; -pub type Keymaps = HashMap<state::Mode, Keymap>; +pub type Keymaps = HashMap<Mode, Keymap>; macro_rules! key { ($ch:expr) => { @@ -128,7 +129,7 @@ macro_rules! ctrl { pub fn default() -> Keymaps { hashmap!( - state::Mode::Normal => + Mode::Normal => // as long as you cast the first item, rust is able to infer the other cases hashmap!( vec![key!('h')] => commands::move_char_left as Command, @@ -179,7 +180,7 @@ pub fn default() -> Keymaps { vec![ctrl!('u')] => commands::half_page_up, vec![ctrl!('d')] => commands::half_page_down, ), - state::Mode::Insert => hashmap!( + Mode::Insert => hashmap!( vec![Key { code: KeyCode::Esc, modifiers: Modifiers::NONE @@ -201,7 +202,7 @@ pub fn default() -> Keymaps { modifiers: Modifiers::NONE }] => commands::insert::insert_tab, ), - state::Mode::Goto => hashmap!( + Mode::Goto => hashmap!( vec![Key { code: KeyCode::Esc, modifiers: Modifiers::NONE |