commit 5c2eccd55d5e11e0bcd3852fe47a2be2d25edd9a (tree)
parent b1df5f1226676ae52380a214e0b13af1250951cd
Author: Tim Pope <code@tpope.net>
Date: Sun, 6 May 2018 22:35:44 -0400
Fix unique map check
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -110,9 +110,6 @@ endfunction
function! s:map(mode, lhs, rhs, ...) abort
let flags = (a:0 ? a:1 : '') . (a:rhs =~# '^<Plug>' ? '' : '<script>')
- if flags =~# '<unique>' && !empty(mapcheck(a:lhs, a:mode))
- return
- endif
let head = a:lhs
let tail = ''
let keys = get(g:, a:mode.'remap', {})
@@ -130,7 +127,9 @@ function! s:map(mode, lhs, rhs, ...) abort
let tail = matchstr(head, '<[^<>]*>$\|.$') . tail
let head = substitute(head, '<[^<>]*>$\|.$', '', '')
endwhile
- exe a:mode.'map <buffer>' flags head.tail a:rhs
+ if flags !~# '<unique>' || empty(mapcheck(head.tail, a:mode))
+ exe a:mode.'map <buffer>' flags head.tail a:rhs
+ endif
endfunction
function! s:add_methods(namespace, method_names) abort