Run QuickFix autocommands on :Gclog

This commit is contained in:
Tim Pope
2020-01-05 16:30:26 -05:00
parent 295f41bbf4
commit 2bcf755c6e

View File

@@ -206,9 +206,11 @@ function! s:QuickfixCreate(nr, opts) abort
endif endif
endfunction endfunction
function! s:QuickfixStream(nr, title, cmd, first, callback, ...) abort function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort
let opts = {'title': a:title, 'context': {'items': []}} let opts = {'title': a:title, 'context': {'items': []}}
call s:QuickfixCreate(a:nr, opts) call s:QuickfixCreate(a:nr, opts)
let event = (a:nr < 0 ? 'c' : 'l') . 'fugitive-' . a:event
silent exe s:DoAutocmd('QuickFixCmdPre ' . event)
let winnr = winnr() let winnr = winnr()
exe a:nr < 0 ? 'copen' : 'lopen' exe a:nr < 0 ? 'copen' : 'lopen'
if winnr != winnr() if winnr != winnr()
@@ -232,6 +234,7 @@ function! s:QuickfixStream(nr, title, cmd, first, callback, ...) abort
lockvar opts.context.items lockvar opts.context.items
call s:QuickfixSet(a:nr, buffer, 'a') call s:QuickfixSet(a:nr, buffer, 'a')
silent exe s:DoAutocmd('QuickFixCmdPost ' . event)
if a:first && len(s:QuickfixGet(a:nr)) if a:first && len(s:QuickfixGet(a:nr))
call s:BlurStatus() call s:BlurStatus()
return a:nr < 0 ? 'cfirst' : 'lfirst' return a:nr < 0 ? 'cfirst' : 'lfirst'
@@ -4051,7 +4054,7 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort
if empty(paths + extra_paths) && empty(a:type) && len(s:Relative('/')) if empty(paths + extra_paths) && empty(a:type) && len(s:Relative('/'))
let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after
endif endif
return s:QuickfixStream(listnr, title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after
endfunction endfunction
" Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread " Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread