Fix unique map check
This commit is contained in:
parent
b1df5f1226
commit
5c2eccd55d
@ -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
|
||||||
|
if flags !~# '<unique>' || empty(mapcheck(head.tail, a:mode))
|
||||||
exe a:mode.'map <buffer>' flags head.tail a:rhs
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user