Allow overwriting insert mode maps (#1030)

According to `:h hasmapto()` if we don't pass the mode as an argument
then only normal, visual and operator-pending modes are checked.

Lets pass the mode explicitly to allow overwriting insert mode mappings.
This commit is contained in:
David Sierra DiazGranados
2020-10-19 21:30:28 -05:00
committed by GitHub
parent ea4a5e3bb2
commit 527ca1b7a1
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -212,7 +212,7 @@ endfunc
function! vimwiki#u#map_key(mode, key, plug, ...) abort
if a:0 && a:1 == 2
" global mappings
if !hasmapto(a:plug) && maparg(a:key, a:mode) ==# ''
if !hasmapto(a:plug, a:mode) && maparg(a:key, a:mode) ==# ''
exe a:mode . 'map ' . a:key . ' ' . a:plug
endif
elseif a:0 && a:1 == 1
@@ -220,7 +220,7 @@ function! vimwiki#u#map_key(mode, key, plug, ...) abort
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
else
" vimwiki buffer mappings
if !hasmapto(a:plug)
if !hasmapto(a:plug, a:mode)
exe a:mode . 'map <buffer> ' . a:key . ' ' . a:plug
endif
endif