vim: Add basic mark support (#11507)

Release Notes:
- vim: Added support for buffer-local marks (`'a-'z`) and some builtin
marks `'<`,`'>`,`'[`,`']`, `'{`, `'}` and `^`. Global marks (`'A-'Z`),
and other builtin marks (`'0-'9`, `'(`, `')`, `''`, `'.`, `'"`) are not
yet implemented. (#5122)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Zachiah Sawyer 2024-05-09 17:51:19 -07:00 committed by GitHub
parent 9cef0ac869
commit 901cb8b3d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 471 additions and 6 deletions

View file

@ -39,6 +39,24 @@ fn copy_selections_content_internal(
let mut text = String::new();
let mut clipboard_selections = Vec::with_capacity(selections.len());
let mut ranges_to_highlight = Vec::new();
vim.update_state(|state| {
state.marks.insert(
"[".to_string(),
selections
.iter()
.map(|s| buffer.anchor_before(s.start))
.collect(),
);
state.marks.insert(
"]".to_string(),
selections
.iter()
.map(|s| buffer.anchor_after(s.end))
.collect(),
)
});
{
let mut is_first = true;
for selection in selections.iter() {