on master help sign in
Move pickers under my leader key mode (space).
commitdfc17becd56efbc1f65de7c8d65cb32ad4690db1 authorBlaž Hrastnik <blaz@mxxn.io> dateTue 30 Mar 2021, 18:38 (6 years ago) parente166da2
2 files changed+22−2
helix-term/src/commands.rs+20 helix-term/src/keymap.rs+2−2
helix-term/src/commands.rs+20
@@ -1853,3 +1853,23 @@ pub fn jump_backward(cx: &mut Context) {
18531853 doc.set_selection(selection);
18541854 };
18551855}
1856+
1857+//
1858+
1859+pub fn space_mode(cx: &mut Context) {
1860+ cx.on_next_key(move |cx, event| {
1861+ if let KeyEvent {
1862+ code: KeyCode::Char(ch),
1863+ ..
1864+ } = event
1865+ {
1866+ // TODO: temporarily show SPC in the mode list
1867+ match ch {
1868+ 'f' => file_picker(cx),
1869+ 'b' => buffer_picker(cx),
1870+ // ' ' => toggle_alternate_buffer(cx),
1871+ _ => (),
1872+ }
1873+ }
1874+ })
1875+}
helix-term/src/keymap.rs+2−2
@@ -244,8 +244,6 @@ pub fn default() -> Keymaps {
244244 ctrl!('u') => commands::half_page_up,
245245 ctrl!('d') => commands::half_page_down,
246246
247− ctrl!('p') => commands::file_picker,
248− ctrl!('b') => commands::buffer_picker,
249247 KeyEvent {
250248 code: KeyCode::Tab,
251249 modifiers: KeyModifiers::NONE
@@ -260,6 +258,8 @@ pub fn default() -> Keymaps {
260258 ctrl!('i') => commands::jump_forward, // TODO: ctrl-i conflicts tab
261259 ctrl!('o') => commands::jump_backward,
262260 // ctrl!('s') => commands::save_selection,
261+
262+ key!(' ') => commands::space_mode,
263263 );
264264 // TODO: decide whether we want normal mode to also be select mode (kakoune-like), or whether
265265 // we keep this separate select mode. More keys can fit into normal mode then, but it's weird