mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Provide g:fugitive_defer_to_existing_maps
References: https://github.com/tpope/vim-fugitive/issues/1425
This commit is contained in:
@@ -208,7 +208,7 @@ let s:nowait = v:version >= 704 ? '<nowait>' : ''
|
|||||||
|
|
||||||
function! s:Map(mode, lhs, rhs, ...) abort
|
function! s:Map(mode, lhs, rhs, ...) abort
|
||||||
let maps = []
|
let maps = []
|
||||||
let unique = a:0 && a:1 =~# '<unique>'
|
let defer = a:0 && a:1 =~# '<unique>' || get(g:, 'fugitive_defer_to_existing_maps')
|
||||||
let flags = substitute(a:0 ? a:1 : '', '<unique>', '', '') . (a:rhs =~# '<Plug>' ? '' : '<script>') . s:nowait
|
let flags = substitute(a:0 ? a:1 : '', '<unique>', '', '') . (a:rhs =~# '<Plug>' ? '' : '<script>') . s:nowait
|
||||||
for mode in split(a:mode, '\zs')
|
for mode in split(a:mode, '\zs')
|
||||||
if a:0 <= 1
|
if a:0 <= 1
|
||||||
@@ -230,7 +230,7 @@ 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 !skip && (!unique || empty(mapcheck(head.tail, mode)))
|
if !skip && (!defer || empty(mapcheck(head.tail, mode)))
|
||||||
call add(maps, mode.'map <buffer>' . flags . ' ' . head.tail . ' ' . a:rhs)
|
call add(maps, mode.'map <buffer>' . flags . ' ' . head.tail . ' ' . a:rhs)
|
||||||
if a:0 > 1 && a:2
|
if a:0 > 1 && a:2
|
||||||
let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') .
|
let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') .
|
||||||
|
|||||||
@@ -725,7 +725,7 @@ function! s:Map(mode, lhs, rhs, flags) abort
|
|||||||
let head = substitute(head, '<[^<>]*>$\|.$', '', '')
|
let head = substitute(head, '<[^<>]*>$\|.$', '', '')
|
||||||
endwhile
|
endwhile
|
||||||
endif
|
endif
|
||||||
if flags !~# '<unique>' || empty(mapcheck(head.tail, a:mode))
|
if empty(mapcheck(head.tail, a:mode))
|
||||||
exe a:mode.'map' s:nowait flags head.tail a:rhs
|
exe a:mode.'map' s:nowait flags head.tail a:rhs
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user