mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Provide User FugitiveEditor event
I'm not sure if this should trigger every time the buffer is loaded, or only on the initial split. Arbitrarily pick the latter for now. References: https://github.com/tpope/vim-fugitive/issues/1828
This commit is contained in:
@@ -3145,8 +3145,18 @@ function! s:RunEdit(state, tmp, job) abort
|
|||||||
let file = FugitiveVimPath(readfile(sentinel, '', 1)[0])
|
let file = FugitiveVimPath(readfile(sentinel, '', 1)[0])
|
||||||
exe substitute(a:state.mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file)
|
exe substitute(a:state.mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file)
|
||||||
set bufhidden=wipe
|
set bufhidden=wipe
|
||||||
let s:edit_jobs[bufnr('')] = [a:state, a:tmp, a:job, sentinel]
|
let bufnr = bufnr('')
|
||||||
|
let s:edit_jobs[bufnr] = [a:state, a:tmp, a:job, sentinel]
|
||||||
call fugitive#DidChange(a:state.git_dir)
|
call fugitive#DidChange(a:state.git_dir)
|
||||||
|
if bufnr == bufnr('') && !exists('g:fugitive_event')
|
||||||
|
try
|
||||||
|
let g:fugitive_event = a:state.git_dir
|
||||||
|
let g:fugitive_result = a:state
|
||||||
|
exe s:DoAutocmd('User FugitiveEditor')
|
||||||
|
finally
|
||||||
|
unlet! g:fugitive_event g:fugitive_result
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -656,6 +656,10 @@ FugitiveIndex After loading the |fugitive-summary| buffer.
|
|||||||
FugitivePager After loading a temp file created by a command like
|
FugitivePager After loading a temp file created by a command like
|
||||||
:Git --paginate or :Git blame.
|
:Git --paginate or :Git blame.
|
||||||
|
|
||||||
|
*User_FugitiveEditor*
|
||||||
|
FugitiveEditor After a :Git command (e.g., :Git commit) edits a file
|
||||||
|
(e.g., the commit message).
|
||||||
|
|
||||||
*User_FugitiveChanged*
|
*User_FugitiveChanged*
|
||||||
FugitiveChanged After any event which can potentially change the
|
FugitiveChanged After any event which can potentially change the
|
||||||
repository, for example, any invocation of |:Git|.
|
repository, for example, any invocation of |:Git|.
|
||||||
|
|||||||
Reference in New Issue
Block a user