mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -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)
|
if gitgutter#utility#is_active(a:bufnr)
|
||||||
|
|
||||||
|
call s:setup_maps(a:bufnr)
|
||||||
|
|
||||||
let p = gitgutter#utility#repo_path(a:bufnr, 0)
|
let p = gitgutter#utility#repo_path(a:bufnr, 0)
|
||||||
if type(p) != s:t_string || empty(p)
|
if type(p) != s:t_string || empty(p)
|
||||||
call s:setup_maps()
|
|
||||||
|
|
||||||
let Continuation = function('gitgutter#process_buffer', [a:bufnr, a:force])
|
let Continuation = function('gitgutter#process_buffer', [a:bufnr, a:force])
|
||||||
let ret = gitgutter#utility#set_repo_path(a:bufnr, Continuation)
|
let ret = gitgutter#utility#set_repo_path(a:bufnr, Continuation)
|
||||||
if ret ==# 'async'
|
if ret ==# 'async'
|
||||||
@@ -107,11 +107,15 @@ endfunction
|
|||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
function! s:setup_maps()
|
function! s:setup_maps(bufnr)
|
||||||
if !g:gitgutter_map_keys
|
if !g:gitgutter_map_keys
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if gitgutter#utility#getbufvar(a:bufnr, 'mapped', 0)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
if !hasmapto('<Plug>GitGutterPrevHunk') && maparg('[c', 'n') ==# ''
|
if !hasmapto('<Plug>GitGutterPrevHunk') && maparg('[c', 'n') ==# ''
|
||||||
nmap <buffer> [c <Plug>GitGutterPrevHunk
|
nmap <buffer> [c <Plug>GitGutterPrevHunk
|
||||||
endif
|
endif
|
||||||
@@ -141,6 +145,8 @@ function! s:setup_maps()
|
|||||||
if !hasmapto('<Plug>GitGutterTextObjectOuterVisual') && maparg('ac', 'x') ==# ''
|
if !hasmapto('<Plug>GitGutterTextObjectOuterVisual') && maparg('ac', 'x') ==# ''
|
||||||
xmap <buffer> ac <Plug>GitGutterTextObjectOuterVisual
|
xmap <buffer> ac <Plug>GitGutterTextObjectOuterVisual
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call gitgutter#utility#setbufvar(a:bufnr, 'mapped', 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:has_fresh_changes(bufnr) abort
|
function! s:has_fresh_changes(bufnr) abort
|
||||||
|
|||||||
Reference in New Issue
Block a user