mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 12:03:48 -05:00
Only act when there is a file to act on.
This commit is contained in:
@@ -39,6 +39,10 @@ function! s:current_file()
|
|||||||
return expand("%:p")
|
return expand("%:p")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:exists_current_file()
|
||||||
|
return strlen(s:current_file()) > 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:directory_of_current_file()
|
function! s:directory_of_current_file()
|
||||||
return expand("%:p:h")
|
return expand("%:p:h")
|
||||||
endfunction
|
endfunction
|
||||||
@@ -189,7 +193,7 @@ endfunction
|
|||||||
" Public interface {{{
|
" Public interface {{{
|
||||||
|
|
||||||
function! GitGutter()
|
function! GitGutter()
|
||||||
if s:is_in_a_git_repo() && s:is_tracked_by_git()
|
if s:exists_current_file() && s:is_in_a_git_repo() && s:is_tracked_by_git()
|
||||||
call s:init()
|
call s:init()
|
||||||
let diff = s:run_diff()
|
let diff = s:run_diff()
|
||||||
let hunks = s:parse_diff(diff)
|
let hunks = s:parse_diff(diff)
|
||||||
|
|||||||
Reference in New Issue
Block a user