mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Separate setting maps from setting repo path.
This commit is contained in:
@@ -25,10 +25,10 @@ function! gitgutter#process_buffer(bufnr, force) abort
|
||||
|
||||
if gitgutter#utility#is_active(a:bufnr)
|
||||
|
||||
call s:setup_maps(a:bufnr)
|
||||
|
||||
let p = gitgutter#utility#repo_path(a:bufnr, 0)
|
||||
if type(p) != s:t_string || empty(p)
|
||||
call s:setup_maps()
|
||||
|
||||
let Continuation = function('gitgutter#process_buffer', [a:bufnr, a:force])
|
||||
let ret = gitgutter#utility#set_repo_path(a:bufnr, Continuation)
|
||||
if ret ==# 'async'
|
||||
@@ -107,11 +107,15 @@ endfunction
|
||||
|
||||
" }}}
|
||||
|
||||
function! s:setup_maps()
|
||||
function! s:setup_maps(bufnr)
|
||||
if !g:gitgutter_map_keys
|
||||
return
|
||||
endif
|
||||
|
||||
if gitgutter#utility#getbufvar(a:bufnr, 'mapped', 0)
|
||||
return
|
||||
endif
|
||||
|
||||
if !hasmapto('<Plug>GitGutterPrevHunk') && maparg('[c', 'n') ==# ''
|
||||
nmap <buffer> [c <Plug>GitGutterPrevHunk
|
||||
endif
|
||||
@@ -141,6 +145,8 @@ function! s:setup_maps()
|
||||
if !hasmapto('<Plug>GitGutterTextObjectOuterVisual') && maparg('ac', 'x') ==# ''
|
||||
xmap <buffer> ac <Plug>GitGutterTextObjectOuterVisual
|
||||
endif
|
||||
|
||||
call gitgutter#utility#setbufvar(a:bufnr, 'mapped', 1)
|
||||
endfunction
|
||||
|
||||
function! s:has_fresh_changes(bufnr) abort
|
||||
|
||||
Reference in New Issue
Block a user