feat(mapset): support restoring Lua callback (#20024)

vim-patch:9.0.0341: mapset() does not restore <Nop> mapping properly

Problem:    mapset() does not restore <Nop> mapping properly.
Solution:   Use an empty string for <Nop>. (closes vim/vim#11022)
92a3d20682
This commit is contained in:
zeertzjq
2022-09-01 06:19:49 +08:00
committed by GitHub
parent c0050b71e5
commit 0c6b39894f
4 changed files with 100 additions and 30 deletions

View File

@@ -964,14 +964,7 @@ func s:DeleteCommands()
nunmap K
else
" call mapset(s:k_map_saved)
let mode = s:k_map_saved.mode !=# ' ' ? s:k_map_saved.mode : ''
call nvim_set_keymap(mode, 'K', s:k_map_saved.rhs, {
\ 'expr': s:k_map_saved.expr ? v:true : v:false,
\ 'noremap': s:k_map_saved.noremap ? v:true : v:false,
\ 'nowait': s:k_map_saved.nowait ? v:true : v:false,
\ 'script': s:k_map_saved.script ? v:true : v:false,
\ 'silent': s:k_map_saved.silent ? v:true : v:false,
\ })
call mapset('n', 0, s:k_map_saved)
endif
unlet s:k_map_saved
endif