commit 0840f001feadf967898deadf977d4e7b2f35eaf4 (tree)
parent 8d25dd777c5875d72328799878dd93f15f0e64c6
Author: Tim Pope <code@tpope.net>
Date: Sun, 5 Sep 2021 10:00:39 -0400
Avoid error when mapcheck() and <unique> semantics differ
References: https://github.com/tpope/vim-fugitive/issues/1826
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -219,7 +219,7 @@ function! s:Map(mode, lhs, rhs, ...) abort
let head = substitute(head, '<[^<>]*>$\|.$', '', '')
endwhile
if !skip && (flags !~# '<unique>' || empty(mapcheck(head.tail, mode)))
- call add(maps, mode.'map <buffer>' . s:nowait . flags . ' ' . head.tail . ' ' . a:rhs)
+ call add(maps, mode.'map <buffer>' . s:nowait . substitute(flags, '<unique>', '', '') . ' ' . head.tail . ' ' . a:rhs)
if a:0 > 1
let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') .
\ '|sil! exe "' . mode . 'unmap <buffer> ' . head.tail . '"'