Fix unique map check

This commit is contained in:
Tim Pope 2018-05-06 22:35:44 -04:00
parent b1df5f1226
commit 5c2eccd55d

View File

@ -110,9 +110,6 @@ endfunction
function! s:map(mode, lhs, rhs, ...) abort function! s:map(mode, lhs, rhs, ...) abort
let flags = (a:0 ? a:1 : '') . (a:rhs =~# '^<Plug>' ? '' : '<script>') 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 head = a:lhs
let tail = '' let tail = ''
let keys = get(g:, a:mode.'remap', {}) let keys = get(g:, a:mode.'remap', {})
@ -130,7 +127,9 @@ function! s:map(mode, lhs, rhs, ...) abort
let tail = matchstr(head, '<[^<>]*>$\|.$') . tail let tail = matchstr(head, '<[^<>]*>$\|.$') . tail
let head = substitute(head, '<[^<>]*>$\|.$', '', '') let head = substitute(head, '<[^<>]*>$\|.$', '', '')
endwhile 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 endfunction
function! s:add_methods(namespace, method_names) abort function! s:add_methods(namespace, method_names) abort