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:
parent
148131786f
commit
265caed15e
18 changed files with 982 additions and 281 deletions
|
@ -18,7 +18,7 @@ use crate::{
|
|||
indent::IndentDirection,
|
||||
motion::{self, first_non_whitespace, next_line_end, right, Motion},
|
||||
object::Object,
|
||||
state::{Mode, Operator},
|
||||
state::{Mark, Mode, Operator},
|
||||
surrounds::SurroundsType,
|
||||
Vim,
|
||||
};
|
||||
|
@ -355,11 +355,13 @@ impl Vim {
|
|||
self.start_recording(cx);
|
||||
self.switch_mode(Mode::Insert, false, window, cx);
|
||||
self.update_editor(window, cx, |vim, editor, window, cx| {
|
||||
if let Some(marks) = vim.marks.get("^") {
|
||||
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
|
||||
s.select_anchor_ranges(marks.iter().map(|mark| *mark..*mark))
|
||||
});
|
||||
}
|
||||
let Some(Mark::Local(marks)) = vim.get_mark("^", editor, window, cx) else {
|
||||
return;
|
||||
};
|
||||
|
||||
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
|
||||
s.select_anchor_ranges(marks.iter().map(|mark| *mark..*mark))
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue