Trigger FugitiveChanged after writing stage buffer

I deliberately omitted this event when adding FugitiveChanged, because I
figured it made sense for consumers to instead tap into BufWritePost to
see which file changed exactly.  This would enable, say, vim-gitgutter,
to only refresh signs for the file that actually changed, rather
than for every file in the repository.  In practice, however,
vim-gitgutter doesn't even bother with "in the repository", let alone
the exact file, opting instead to refresh every loaded buffer.  I give
up.

Resolves: https://github.com/tpope/vim-fugitive/issues/1819
This commit is contained in:
Tim Pope
2021-08-25 22:38:47 -04:00
parent 09d3551627
commit 7e21d414a8

View File

@@ -2752,6 +2752,7 @@ function! fugitive#FileWriteCmd(...) abort
if exists('#' . autype . 'WritePost') if exists('#' . autype . 'WritePost')
execute s:DoAutocmd(autype . 'WritePost ' . s:fnameescape(amatch)) execute s:DoAutocmd(autype . 'WritePost ' . s:fnameescape(amatch))
endif endif
exe s:DoAutocmdChanged(dir)
return '' return ''
else else
return 'echoerr '.string('fugitive: '.error) return 'echoerr '.string('fugitive: '.error)