vim: Add global marks (#25702)

Closes https://github.com/zed-industries/zed/issues/13111

Release Notes:

- vim: Added global marks `'[A-Z]`
- vim: Added persistence for global (and local) marks. When re-opening
the same workspace your previous marks will be available.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
AidanV 2025-03-14 22:58:34 -07:00 committed by GitHub
parent 148131786f
commit 265caed15e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 982 additions and 281 deletions

View file

@ -26,7 +26,7 @@ use editor::{
Anchor, Bias, Editor, EditorEvent, EditorMode, EditorSettings, ToPoint,
};
use gpui::{
actions, impl_actions, Action, App, AppContext as _, Axis, Context, Entity, EventEmitter,
actions, impl_actions, Action, App, AppContext, Axis, Context, Entity, EventEmitter,
KeyContext, KeystrokeEvent, Render, Subscription, Task, WeakEntity, Window,
};
use insert::{NormalBefore, TemporaryNormal};
@ -314,7 +314,6 @@ pub(crate) struct Vim {
operator_stack: Vec<Operator>,
pub(crate) replacements: Vec<(Range<editor::Anchor>, String)>,
pub(crate) marks: HashMap<String, Vec<Anchor>>,
pub(crate) stored_visual_mode: Option<(Mode, Vec<bool>)>,
pub(crate) change_list: Vec<Vec<Anchor>>,
pub(crate) change_list_position: Option<usize>,
@ -362,7 +361,6 @@ impl Vim {
operator_stack: Vec::new(),
replacements: Vec::new(),
marks: HashMap::default(),
stored_visual_mode: None,
change_list: Vec::new(),
change_list_position: None,
@ -1573,7 +1571,7 @@ impl Vim {
}
_ => self.clear_operator(window, cx),
},
Some(Operator::Mark) => self.create_mark(text, false, window, cx),
Some(Operator::Mark) => self.create_mark(text, window, cx),
Some(Operator::RecordRegister) => {
self.record_register(text.chars().next().unwrap(), window, cx)
}