diff --git a/autoload/gitgutter.vim b/autoload/gitgutter.vim index 3265488..825e067 100644 --- a/autoload/gitgutter.vim +++ b/autoload/gitgutter.vim @@ -154,7 +154,7 @@ function! gitgutter#stage_hunk() if gitgutter#utility#is_active() " Ensure the working copy of the file is up to date. " It doesn't make sense to stage a hunk otherwise. - silent write + noautocmd silent write if empty(gitgutter#hunk#current_hunk()) call gitgutter#utility#warn('cursor is not in a hunk') @@ -174,7 +174,7 @@ function! gitgutter#revert_hunk() if gitgutter#utility#is_active() " Ensure the working copy of the file is up to date. " It doesn't make sense to stage a hunk otherwise. - silent write + noautocmd silent write if empty(gitgutter#hunk#current_hunk()) call gitgutter#utility#warn('cursor is not in a hunk') @@ -192,7 +192,7 @@ endfunction function! gitgutter#preview_hunk() if gitgutter#utility#is_active() - silent write + noautocmd silent write if empty(gitgutter#hunk#current_hunk()) call gitgutter#utility#warn('cursor is not in a hunk') diff --git a/autoload/gitgutter/diff.vim b/autoload/gitgutter/diff.vim index 6ebf688..6883d9f 100644 --- a/autoload/gitgutter/diff.vim +++ b/autoload/gitgutter/diff.vim @@ -276,8 +276,7 @@ endfunction " " type - stage | revert | preview function! gitgutter#diff#generate_diff_for_hunk(type) - " Although (we assume) diff is up to date, we don't store it anywhere so we - " have to regenerate it now... + " Run a fresh diff. let diff = gitgutter#diff#run_diff(0, 0) let diff_for_hunk = gitgutter#diff#discard_hunks(diff, a:type == 'stage' || a:type == 'revert')