aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/keymap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/keymap.rs')
-rw-r--r--helix-view/src/keymap.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/helix-view/src/keymap.rs b/helix-view/src/keymap.rs
index 69e6cabb..c815911e 100644
--- a/helix-view/src/keymap.rs
+++ b/helix-view/src/keymap.rs
@@ -1,5 +1,6 @@
use crate::commands::{self, Command};
-use helix_core::{hashmap, state};
+use crate::document::Mode;
+use helix_core::hashmap;
use std::collections::HashMap;
// Kakoune-inspired:
@@ -81,14 +82,17 @@ use std::collections::HashMap;
// = = align?
// + =
// }
+//
+// gd = goto definition
+// gr = goto reference
// }
#[cfg(feature = "term")]
pub use crossterm::event::{KeyCode, KeyEvent as Key, KeyModifiers as Modifiers};
// TODO: could be trie based
-type Keymap = HashMap<Vec<Key>, Command>;
-type Keymaps = HashMap<state::Mode, Keymap>;
+pub type Keymap = HashMap<Vec<Key>, Command>;
+pub type Keymaps = HashMap<Mode, Keymap>;
macro_rules! key {
($ch:expr) => {
@@ -128,7 +132,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 +183,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 +205,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