fix(termdebug): replace mapset with nvim_set_keymap (#15699)

Co-authored-by: ii14 <ii14@users.noreply.github.com>
This commit is contained in:
ii14 2021-09-17 19:29:27 +02:00 committed by GitHub
parent d9f93e5642
commit 4d7dcbe49f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -826,7 +826,14 @@ func s:InstallCommands()
command Winbar call s:InstallWinbar() command Winbar call s:InstallWinbar()
if !exists('g:termdebug_map_K') || g:termdebug_map_K 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<CR> nnoremap K :Evaluate<CR>
endif endif
@ -870,7 +877,15 @@ func s:DeleteCommands()
if empty(s:k_map_saved) if empty(s:k_map_saved)
nunmap K nunmap K
else 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 endif
unlet s:k_map_saved unlet s:k_map_saved
endif endif