From 9cc5fa7ecc23b052bd524d07c85356c64b92aeef Mon Sep 17 00:00:00 2001 From: Roy-Orbison Date: Mon, 23 Aug 2021 04:45:52 +0930 Subject: [PATCH] Overwrite existing bookmarks when updating (#161) Instead of completely removing the previous bookmark and adding a new one, attempt to overwrite it and clean it up only if required. --- autoload/bm.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/bm.vim b/autoload/bm.vim index 3a6d83d..4bbd782 100644 --- a/autoload/bm.vim +++ b/autoload/bm.vim @@ -46,8 +46,11 @@ endfunction function! bm#update_bookmark_for_sign(file, sign_idx, new_line_nr, new_content) let bookmark = bm#get_bookmark_by_sign(a:file, a:sign_idx) - call bm#del_bookmark_at_line(a:file, bookmark['line_nr']) + let old_line_nr = bookmark['line_nr'] call bm#add_bookmark(a:file, a:sign_idx, a:new_line_nr, a:new_content, bookmark['annotation']) + if old_line_nr !=# a:new_line_nr + unlet g:line_map[a:file][old_line_nr] + endif endfunction function! bm#update_annotation(file, sign_idx, annotation)