vim-patch:8.2.4861: it is not easy to restore saved mappings

Problem:    It is not easy to restore saved mappings.
Solution:   Make mapset() accept a dict argument. (Ernie Rael, closes vim/vim#10295)

51d04d16f2

Co-authored-by: Ernie Rael <errael@raelity.com>
This commit is contained in:
zeertzjq
2023-11-09 19:48:50 +08:00
parent d4dbfb092b
commit f748a73a35
9 changed files with 350 additions and 41 deletions

View File

@@ -1116,8 +1116,7 @@ func s:DeleteCommands()
if exists('s:k_map_saved')
if !empty(s:k_map_saved) && !s:k_map_saved.buffer
nunmap K
" call mapset(s:k_map_saved)
call mapset('n', 0, s:k_map_saved)
call mapset(s:k_map_saved)
elseif empty(s:k_map_saved)
nunmap K
endif
@@ -1126,8 +1125,7 @@ func s:DeleteCommands()
if exists('s:plus_map_saved')
if !empty(s:plus_map_saved) && !s:plus_map_saved.buffer
nunmap +
" call mapset(s:plus_map_saved)
call mapset('n', 0, s:plus_map_saved)
call mapset(s:plus_map_saved)
elseif empty(s:plus_map_saved)
nunmap +
endif
@@ -1136,8 +1134,7 @@ func s:DeleteCommands()
if exists('s:minus_map_saved')
if !empty(s:minus_map_saved) && !s:minus_map_saved.buffer
nunmap -
" call mapset(s:minus_map_saved)
call mapset('n', 0, s:minus_map_saved)
call mapset(s:minus_map_saved)
elseif empty(s:minus_map_saved)
nunmap -
endif