Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Helix jump list (#46467)

prayansh_chhablani485181a06a86
diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json
index d57794e61a9..4d93761eaea 100644
--- a/assets/keymaps/vim.json
+++ b/assets/keymaps/vim.json
@@ -545,6 +545,7 @@
"m": "vim::PushHelixMatch",
"]": ["vim::PushHelixNext", { "around": true }],
"[": ["vim::PushHelixPrevious", { "around": true }],
+ "ctrl-s": "editor::SaveLocation",
"g q": "vim::PushRewrap",
},
},
diff --git a/crates/editor/src/actions.rs b/crates/editor/src/actions.rs
index 6a05f94cf62..8f14e51fb5a 100644
--- a/crates/editor/src/actions.rs
+++ b/crates/editor/src/actions.rs
@@ -907,6 +907,8 @@ actions!(
WrapSelectionsInTag,
/// Aligns selections from different rows into the same column
AlignSelections,
+ /// Saves the current location to navigation history.
+ SaveLocation,
]
);
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 9102fc428f6..d87729db868 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -15987,6 +15987,15 @@ impl Editor {
self.nav_history.as_ref()
}
+ pub fn save_location(
+ &mut self,
+ _: &SaveLocation,
+ _window: &mut Window,
+ cx: &mut Context<Self>,
+ ) {
+ self.create_nav_history_entry(cx);
+ }
+
pub fn create_nav_history_entry(&mut self, cx: &mut Context<Self>) {
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 1cefd2179b7..293a5890e2e 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -490,6 +490,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);