on master help sign in
Add `save_selection` command (#1247)
commitb66d3d3d9dccbb9c28d8611c4a0fc5d74ccb27d6 authorOmnikar <omnikar5@gmail.com> dateThu 9 Dec 2021, 21:46 (5 years ago) parent44681c5
3 files changed+9−1
book/src/keymap.md+1 helix-term/src/commands.rs+7 helix-term/src/keymap.rs+1−1
book/src/keymap.md+1
@@ -34,6 +34,7 @@
3434| `Ctrl-d` | Move half page down | `half_page_down` |
3535| `Ctrl-i` | Jump forward on the jumplist | `jump_forward` |
3636| `Ctrl-o` | Jump backward on the jumplist | `jump_backward` |
37+| `Ctrl-s` | Save the current selection to the jumplist | `save_selection` |
3738| `v` | Enter [select (extend) mode](#select--extend-mode) | `select_mode` |
3839| `g` | Enter [goto mode](#goto-mode) | N/A |
3940| `m` | Enter [match mode](#match-mode) | N/A |
helix-term/src/commands.rs+7
@@ -362,6 +362,7 @@ impl MappableCommand {
362362 expand_selection, "Expand selection to parent syntax node",
363363 jump_forward, "Jump forward on jumplist",
364364 jump_backward, "Jump backward on jumplist",
365+ save_selection, "Save the current selection to the jumplist",
365366 jump_view_right, "Jump to the split to the right",
366367 jump_view_left, "Jump to the split to the left",
367368 jump_view_up, "Jump to the split above",
@@ -5285,6 +5286,12 @@ fn jump_backward(cx: &mut Context) {
52855286 };
52865287}
52875288
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+
52885295fn rotate_view(cx: &mut Context) {
52895296 cx.editor.focus_next()
52905297}
helix-term/src/keymap.rs+1−1
@@ -641,7 +641,7 @@ impl Default for Keymaps {
641641
642642 "tab" => jump_forward, // tab == <C-i>
643643 "C-o" => jump_backward,
644− // "C-s" => save_selection,
644+ "C-s" => save_selection,
645645
646646 "space" => { "Space"
647647 "f" => file_picker,