Only act when there is a file to act on.

This commit is contained in:
Andy Stewart
2013-02-22 09:57:21 +01:00
parent 5670e9b674
commit ac920417b8

View File

@@ -39,6 +39,10 @@ function! s:current_file()
return expand("%:p")
endfunction
function! s:exists_current_file()
return strlen(s:current_file()) > 0
endfunction
function! s:directory_of_current_file()
return expand("%:p:h")
endfunction
@@ -189,7 +193,7 @@ endfunction
" Public interface {{{
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()
let diff = s:run_diff()
let hunks = s:parse_diff(diff)