mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Improve GitGutter User autocommand: context/unsilent
This provides `g:gitgutter_hook_context` during the hook's execution and removes the `:silent`, but uses `exists()` instead. The bufnr might be necessary to know in the User autocommand, e.g. to clear some cache. Not using`:silent` is good practice in general to not hide (wanted) output and errors etc.
This commit is contained in:
committed by
Andy Stewart
parent
4692457ae2
commit
a046b5ace1
@@ -140,7 +140,11 @@ function! gitgutter#diff#handler(bufnr, diff) abort
|
||||
endif
|
||||
|
||||
call s:save_last_seen_change(a:bufnr)
|
||||
execute "silent doautocmd" s:nomodeline "User GitGutter"
|
||||
if exists('#User#GitGutter')
|
||||
let g:gitgutter_hook_context = {'bufnr': a:bufnr}
|
||||
execute 'doautocmd' s:nomodeline 'User GitGutter'
|
||||
unlet g:gitgutter_hook_context
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user