on master help sign in
experiment: Move keep_primary_selection to ,
9ea9e77Blaž Hrastnik
book/src/keymap.md+1−2
@@ -86,6 +86,7 @@
86| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
86| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
87| `;` | Collapse selection onto a single cursor | `collapse_selection` |
87| `;` | Collapse selection onto a single cursor | `collapse_selection` |
88| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
88| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
89+| `,` | Keep only the primary selection | `keep_primary_selection` |
89| `C` | Copy selection onto the next line | `copy_selection_on_next_line` |
90| `C` | Copy selection onto the next line | `copy_selection_on_next_line` |
90| `Alt-C` | Copy selection onto the previous line | `copy_selection_on_prev_line` |
91| `Alt-C` | Copy selection onto the previous line | `copy_selection_on_prev_line` |
91| `(` | Rotate main selection forward | `rotate_selections_backward` |
92| `(` | Rotate main selection forward | `rotate_selections_backward` |
@@ -99,7 +100,6 @@
99| `J` | Join lines inside selection | `join_selections` |
100| `J` | Join lines inside selection | `join_selections` |
100| `K` | Keep selections matching the regex TODO: overlapped by hover help | `keep_selections` |
101| `K` | Keep selections matching the regex TODO: overlapped by hover help | `keep_selections` |
101| `$` | Pipe each selection into shell command, keep selections where command returned 0 | `shell_keep_pipe` |
102| `$` | Pipe each selection into shell command, keep selections where command returned 0 | `shell_keep_pipe` |
102−| `Space` | Keep only the primary selection TODO: overlapped by space mode | `keep_primary_selection` |
103| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
103| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
104
104
105### Search
105### Search
@@ -200,7 +200,6 @@ This layer is a kludge of mappings, mostly pickers.
200| `a` | Apply code action | `code_action` |
200| `a` | Apply code action | `code_action` |
201| `'` | Open last fuzzy picker | `last_picker` |
201| `'` | Open last fuzzy picker | `last_picker` |
202| `w` | Enter [window mode](#window-mode) | N/A |
202| `w` | Enter [window mode](#window-mode) | N/A |
203−| `space` | Keep primary selection TODO: it's here because space mode replaced it | `keep_primary_selection` |
204| `p` | Paste system clipboard after selections | `paste_clipboard_after` |
203| `p` | Paste system clipboard after selections | `paste_clipboard_after` |
205| `P` | Paste system clipboard before selections | `paste_clipboard_before` |
204| `P` | Paste system clipboard before selections | `paste_clipboard_before` |
206| `y` | Join and yank selections to clipboard | `yank_joined_to_clipboard` |
205| `y` | Join and yank selections to clipboard | `yank_joined_to_clipboard` |
helix-term/src/commands.rs+4
@@ -2825,6 +2825,10 @@ fn open_above(cx: &mut Context) {
2825fn normal_mode(cx: &mut Context) {
2825fn normal_mode(cx: &mut Context) {
2826 let (view, doc) = current!(cx.editor);
2826 let (view, doc) = current!(cx.editor);
2827
2827
2828+ if doc.mode == Mode::Normal {
2829+ return;
2830+ }
2831+
2828 doc.mode = Mode::Normal;
2832 doc.mode = Mode::Normal;
2829
2833
2830 doc.append_changes_to_history(view.id);
2834 doc.append_changes_to_history(view.id);
helix-term/src/keymap.rs+1−4
@@ -436,7 +436,6 @@ impl Default for Keymaps {
436 "A" => append_to_line,
436 "A" => append_to_line,
437 "o" => open_below,
437 "o" => open_below,
438 "O" => open_above,
438 "O" => open_above,
439− // [<space> ]<space> equivalents too (add blank new line, no edit)
440
439
441 "d" => delete_selection,
440 "d" => delete_selection,
442 // TODO: also delete without yanking
441 // TODO: also delete without yanking
@@ -500,8 +499,7 @@ impl Default for Keymaps {
500 "K" => keep_selections,
499 "K" => keep_selections,
501 // TODO: and another method for inverse
500 // TODO: and another method for inverse
502
501
503− // TODO: clashes with space mode
504− "space" => keep_primary_selection,
502+ "," => keep_primary_selection,
505
503
506 // "q" => record_macro,
504 // "q" => record_macro,
507 // "Q" => replay_macro,
505 // "Q" => replay_macro,
@@ -554,7 +552,6 @@ impl Default for Keymaps {
554 "p" => paste_clipboard_after,
552 "p" => paste_clipboard_after,
555 "P" => paste_clipboard_before,
553 "P" => paste_clipboard_before,
556 "R" => replace_selections_with_clipboard,
554 "R" => replace_selections_with_clipboard,
557− "space" => keep_primary_selection,
558 "/" => global_search,
555 "/" => global_search,
559 },
556 },
560 "z" => { "View"
557 "z" => { "View"