Fire GitGutterStage User event after staging

Closes #698.
This commit is contained in:
Andy Stewart
2020-04-23 08:59:26 +01:00
parent 2b62481d38
commit 3599736179
3 changed files with 14 additions and 1 deletions

View File

@@ -88,6 +88,10 @@ You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo
You cannot unstage a staged hunk.
After updating the signs, the plugin fires the `GitGutter` User autocommand.
After staging a hunk or part of a hunk, the plugin fires the `GitGutterStage` User autocommand.
#### Activation

View File

@@ -1,4 +1,5 @@
let s:winid = 0
let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '<nomodeline>' : ''
function! gitgutter#hunk#set_hunks(bufnr, hunks) abort
call gitgutter#utility#setbufvar(a:bufnr, 'hunks', a:hunks)
@@ -274,6 +275,10 @@ function! s:stage(hunk_diff)
\ diff)
if v:shell_error
call gitgutter#utility#warn('patch does not apply')
else
if exists('#User#GitGutterStage')
execute 'doautocmd' s:nomodeline 'User GitGutterStage'
endif
endif
" Refresh gitgutter's view of buffer.

View File

@@ -177,7 +177,7 @@ Commands for folds:~
===============================================================================
AUTOCOMMAND *gitgutter-autocommand*
AUTOCOMMANDS *gitgutter-autocommands*
User GitGutter~
@@ -189,6 +189,10 @@ event GitGutter. You can listen for this event, for example:
A dictionary `g:gitgutter_hook_context` is made available during its execution,
which contains an entry `bufnr` that contains the buffer number being updated.
User GitGutterStage~
After staging a hunk or part of a hunk vim-gitgutter fires a |User| |autocmd|
with the event GitGutterStage. Staging always happens in the current buffer.
===============================================================================
MAPPINGS *gitgutter-mappings*