summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-30 09:38:26 +0000
committerBlaž Hrastnik2021-03-30 09:38:26 +0000
commitdfc17becd56efbc1f65de7c8d65cb32ad4690db1 (patch)
tree15a1b60e2154bf259691b24ed48a071c6544a661
parente166da2ab051279f3086e0942f6b7adb1a641a84 (diff)
Move pickers under my leader key mode (space).
-rw-r--r--helix-term/src/commands.rs20
-rw-r--r--helix-term/src/keymap.rs4
2 files changed, 22 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 7233f1da..1b46aa62 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1853,3 +1853,23 @@ pub fn jump_backward(cx: &mut Context) {
doc.set_selection(selection);
};
}
+
+//
+
+pub fn space_mode(cx: &mut Context) {
+ cx.on_next_key(move |cx, event| {
+ if let KeyEvent {
+ code: KeyCode::Char(ch),
+ ..
+ } = event
+ {
+ // TODO: temporarily show SPC in the mode list
+ match ch {
+ 'f' => file_picker(cx),
+ 'b' => buffer_picker(cx),
+ // ' ' => toggle_alternate_buffer(cx),
+ _ => (),
+ }
+ }
+ })
+}
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index eed6ee54..eeecd08e 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -244,8 +244,6 @@ pub fn default() -> Keymaps {
ctrl!('u') => commands::half_page_up,
ctrl!('d') => commands::half_page_down,
- ctrl!('p') => commands::file_picker,
- ctrl!('b') => commands::buffer_picker,
KeyEvent {
code: KeyCode::Tab,
modifiers: KeyModifiers::NONE
@@ -260,6 +258,8 @@ pub fn default() -> Keymaps {
ctrl!('i') => commands::jump_forward, // TODO: ctrl-i conflicts tab
ctrl!('o') => commands::jump_backward,
// ctrl!('s') => commands::save_selection,
+
+ key!(' ') => commands::space_mode,
);
// TODO: decide whether we want normal mode to also be select mode (kakoune-like), or whether
// we keep this separate select mode. More keys can fit into normal mode then, but it's weird