mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
Always use realtime diff when buffer is modified.
This was motivated by Vim regaining focus into a buffer with unsaved changes, and the realtime diff being replaced with an out of date disk diff. With this commit the realtime diff will be run again.
This commit is contained in:
@@ -84,6 +84,10 @@ function! s:directory_of_file()
|
|||||||
return shellescape(fnamemodify(s:file(), ':h'))
|
return shellescape(fnamemodify(s:file(), ':h'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:has_unsaved_changes(file)
|
||||||
|
return getbufvar(a:file, "&mod")
|
||||||
|
endfunction
|
||||||
|
|
||||||
" https://github.com/tpope/vim-dispatch/blob/9cdd05a87f8a47120335be03dfcd8358544221cd/autoload/dispatch/windows.vim#L8-L17
|
" https://github.com/tpope/vim-dispatch/blob/9cdd05a87f8a47120335be03dfcd8358544221cd/autoload/dispatch/windows.vim#L8-L17
|
||||||
function! s:escape(str)
|
function! s:escape(str)
|
||||||
if &shellxquote ==# '"'
|
if &shellxquote ==# '"'
|
||||||
@@ -455,7 +459,7 @@ function! GitGutter(file, ...)
|
|||||||
call s:set_file(a:file)
|
call s:set_file(a:file)
|
||||||
if s:is_active()
|
if s:is_active()
|
||||||
call s:init()
|
call s:init()
|
||||||
if a:0 == 1
|
if (a:0 == 1) || s:has_unsaved_changes(a:file)
|
||||||
let diff = s:run_diff(1)
|
let diff = s:run_diff(1)
|
||||||
else
|
else
|
||||||
let diff = s:run_diff(0)
|
let diff = s:run_diff(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user