on master help sign in
Add `save_selection` command (#1247)
b66d3d3Omnikar
book/src/keymap.md+1
@@ -34,6 +34,7 @@
34| `Ctrl-d` | Move half page down | `half_page_down` |
34| `Ctrl-d` | Move half page down | `half_page_down` |
35| `Ctrl-i` | Jump forward on the jumplist | `jump_forward` |
35| `Ctrl-i` | Jump forward on the jumplist | `jump_forward` |
36| `Ctrl-o` | Jump backward on the jumplist | `jump_backward` |
36| `Ctrl-o` | Jump backward on the jumplist | `jump_backward` |
37+| `Ctrl-s` | Save the current selection to the jumplist | `save_selection` |
37| `v` | Enter [select (extend) mode](#select--extend-mode) | `select_mode` |
38| `v` | Enter [select (extend) mode](#select--extend-mode) | `select_mode` |
38| `g` | Enter [goto mode](#goto-mode) | N/A |
39| `g` | Enter [goto mode](#goto-mode) | N/A |
39| `m` | Enter [match mode](#match-mode) | N/A |
40| `m` | Enter [match mode](#match-mode) | N/A |
helix-term/src/commands.rs+7
@@ -362,6 +362,7 @@ impl MappableCommand {
362 expand_selection, "Expand selection to parent syntax node",
362 expand_selection, "Expand selection to parent syntax node",
363 jump_forward, "Jump forward on jumplist",
363 jump_forward, "Jump forward on jumplist",
364 jump_backward, "Jump backward on jumplist",
364 jump_backward, "Jump backward on jumplist",
365+ save_selection, "Save the current selection to the jumplist",
365 jump_view_right, "Jump to the split to the right",
366 jump_view_right, "Jump to the split to the right",
366 jump_view_left, "Jump to the split to the left",
367 jump_view_left, "Jump to the split to the left",
367 jump_view_up, "Jump to the split above",
368 jump_view_up, "Jump to the split above",
@@ -5285,6 +5286,12 @@ fn jump_backward(cx: &mut Context) {
5285 };
5286 };
5286}
5287}
5287
5288
5289+fn save_selection(cx: &mut Context) {
5290+ push_jump(cx.editor);
5291+ cx.editor
5292+ .set_status("Selection saved to jumplist".to_owned());
5293+}
5294+
5288fn rotate_view(cx: &mut Context) {
5295fn rotate_view(cx: &mut Context) {
5289 cx.editor.focus_next()
5296 cx.editor.focus_next()
5290}
5297}
helix-term/src/keymap.rs+1−1
@@ -641,7 +641,7 @@ impl Default for Keymaps {
641
641
642 "tab" => jump_forward, // tab == <C-i>
642 "tab" => jump_forward, // tab == <C-i>
643 "C-o" => jump_backward,
643 "C-o" => jump_backward,
644− // "C-s" => save_selection,
644+ "C-s" => save_selection,
645
645
646 "space" => { "Space"
646 "space" => { "Space"
647 "f" => file_picker,
647 "f" => file_picker,