From 6f42524a883c64a2f341e7adbeb162b35e630e07 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Fri, 9 Jan 2026 23:33:13 +0530 Subject: [PATCH 1/2] jumplist ctrl-s --- assets/keymaps/vim.json | 1 + crates/editor/src/actions.rs | 6 ++++++ crates/editor/src/editor.rs | 9 +++++++++ crates/editor/src/element.rs | 1 + 4 files changed, 17 insertions(+) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 6e5d3423872a7d..366c0f18ff196d 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -538,6 +538,7 @@ "m": "vim::PushHelixMatch", "]": ["vim::PushHelixNext", { "around": true }], "[": ["vim::PushHelixPrevious", { "around": true }], + "ctrl-s": "editor::SaveLocation", "g q": "vim::PushRewrap", "g w": "vim::PushRewrap", // not a helix default & clashes with helix `goto_word` }, diff --git a/crates/editor/src/actions.rs b/crates/editor/src/actions.rs index ba36f88f6380ad..a9cba620e83ca5 100644 --- a/crates/editor/src/actions.rs +++ b/crates/editor/src/actions.rs @@ -81,6 +81,12 @@ pub struct MoveToEndOfLine { pub stop_at_soft_wraps: bool, } +///Saves the current location to navigation history +#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] +#[action(namespace = editor)] +#[serde(deny_unknown_fields)] +pub struct SaveLocation; + /// Selects from the cursor to the end of the current line. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 8560705802264d..0a40428a7650d0 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -14578,6 +14578,15 @@ impl Editor { self.nav_history.as_ref() } + pub fn save_location( + &mut self, + _: &SaveLocation, + _window: &mut Window, + cx: &mut Context, + ) { + self.create_nav_history_entry(cx); + } + pub fn create_nav_history_entry(&mut self, cx: &mut Context) { self.push_to_nav_history( self.selections.newest_anchor().head(), diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 4c3b44335bcad1..f5d3e584eac7ac 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -461,6 +461,7 @@ impl EditorElement { register_action(editor, window, Editor::unfold_all); register_action(editor, window, Editor::fold_selected_ranges); register_action(editor, window, Editor::set_mark); + register_action(editor, window, Editor::save_location); register_action(editor, window, Editor::swap_selection_ends); register_action(editor, window, Editor::show_completions); register_action(editor, window, Editor::show_word_completions); From 2fa134631e6d043b59c936a810f9a2402f2501ad Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Fri, 24 Apr 2026 08:04:02 +0200 Subject: [PATCH 2/2] Remove obsolete explicit action struct --- crates/editor/src/actions.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/editor/src/actions.rs b/crates/editor/src/actions.rs index 50068f0d115cd3..8f14e51fb5a2f7 100644 --- a/crates/editor/src/actions.rs +++ b/crates/editor/src/actions.rs @@ -81,12 +81,6 @@ pub struct MoveToEndOfLine { pub stop_at_soft_wraps: bool, } -///Saves the current location to navigation history -#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] -#[action(namespace = editor)] -#[serde(deny_unknown_fields)] -pub struct SaveLocation; - /// Selects from the cursor to the end of the current line. #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)] #[action(namespace = editor)] @@ -913,6 +907,8 @@ actions!( WrapSelectionsInTag, /// Aligns selections from different rows into the same column AlignSelections, + /// Saves the current location to navigation history. + SaveLocation, ] );