aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/keymap.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-03 04:12:40 +0000
committerGitHub2020-12-03 04:12:40 +0000
commitb7a3e525ed7fed5ed79e8580df2e3496bd994419 (patch)
treed202637047759b0510a16d8c59fdbbde62b50617 /helix-view/src/keymap.rs
parent2e12fc9a7cd221bb7b5f4b5c1ece599089770ccb (diff)
parent39bf1ca82514e1dc56dfebdce2558cce662367d1 (diff)
Merge pull request #5 from helix-editor/lsp
LSP: mk1
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