on master help sign in
Move pickers under my leader key mode (space).
dfc17beBlaž Hrastnik
helix-term/src/commands.rs+20
@@ -1853,3 +1853,23 @@ pub fn jump_backward(cx: &mut Context) {
1853 doc.set_selection(selection);
1853 doc.set_selection(selection);
1854 };
1854 };
1855}
1855}
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 {
244 ctrl!('u') => commands::half_page_up,
244 ctrl!('u') => commands::half_page_up,
245 ctrl!('d') => commands::half_page_down,
245 ctrl!('d') => commands::half_page_down,
246
246
247− ctrl!('p') => commands::file_picker,
248− ctrl!('b') => commands::buffer_picker,
249 KeyEvent {
247 KeyEvent {
250 code: KeyCode::Tab,
248 code: KeyCode::Tab,
251 modifiers: KeyModifiers::NONE
249 modifiers: KeyModifiers::NONE
@@ -260,6 +258,8 @@ pub fn default() -> Keymaps {
260 ctrl!('i') => commands::jump_forward, // TODO: ctrl-i conflicts tab
258 ctrl!('i') => commands::jump_forward, // TODO: ctrl-i conflicts tab
261 ctrl!('o') => commands::jump_backward,
259 ctrl!('o') => commands::jump_backward,
262 // ctrl!('s') => commands::save_selection,
260 // ctrl!('s') => commands::save_selection,
261+
262+ key!(' ') => commands::space_mode,
263 );
263 );
264 // TODO: decide whether we want normal mode to also be select mode (kakoune-like), or whether
264 // TODO: decide whether we want normal mode to also be select mode (kakoune-like), or whether
265 // we keep this separate select mode. More keys can fit into normal mode then, but it's weird
265 // we keep this separate select mode. More keys can fit into normal mode then, but it's weird