From 527ca1b7a102b5b64d35ce86f2d6f7c6dbbbc017 Mon Sep 17 00:00:00 2001 From: David Sierra DiazGranados Date: Mon, 19 Oct 2020 21:30:28 -0500 Subject: [PATCH] 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. --- autoload/vimwiki/u.vim | 4 ++-- doc/vimwiki.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/vimwiki/u.vim b/autoload/vimwiki/u.vim index b7e350c..cc82db3 100644 --- a/autoload/vimwiki/u.vim +++ b/autoload/vimwiki/u.vim @@ -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 ' . a:key . ' ' . a:plug else " vimwiki buffer mappings - if !hasmapto(a:plug) + if !hasmapto(a:plug, a:mode) exe a:mode . 'map ' . a:key . ' ' . a:plug endif endif diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 0cb6a9e..367b8cc 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3900,6 +3900,7 @@ Fixed:~ * PR #919: Fix duplicate helptag * PR #959: Fix :VimwikiNextTask * PR #986: Fix typo in help file + * PR #1030: Allow overwriting insert mode mappings 2.5 (2020-05-26)~