From 4d7dcbe49f4a1cd691211e4fd316af51241f6544 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Fri, 17 Sep 2021 19:29:27 +0200 Subject: fix(termdebug): replace mapset with nvim_set_keymap (#15699) Co-authored-by: ii14 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 94b97c9f0c..8057d7f284 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -826,7 +826,14 @@ func s:InstallCommands() command Winbar call s:InstallWinbar() if !exists('g:termdebug_map_K') || g:termdebug_map_K - let s:k_map_saved = maparg('K', 'n', 0, 1) + " let s:k_map_saved = maparg('K', 'n', 0, 1) + let s:k_map_saved = {} + for map in nvim_get_keymap('n') + if map.lhs ==# 'K' + let s:k_map_saved = map + break + endif + endfor nnoremap K :Evaluate endif @@ -870,7 +877,15 @@ func s:DeleteCommands() if empty(s:k_map_saved) nunmap K else - call mapset('n', 0, s:k_map_saved) + " call mapset('n', 0, 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, + \ }) endif unlet s:k_map_saved endif -- cgit