Fire synthetic QuickFix events on :Ggrep

References https://github.com/tpope/vim-fugitive/issues/1297
This commit is contained in:
Tim Pope 2019-07-29 13:19:44 -04:00
parent bd89fd440b
commit a3ab24f681

View File

@ -3502,10 +3502,13 @@ function! s:Grep(type, bang, arg) abort
let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args
call s:QuickfixCreate(listnr, {'title': (listnr < 0 ? ':Ggrep ' : ':Glgrep ') . s:fnameescape(args)}) call s:QuickfixCreate(listnr, {'title': (listnr < 0 ? ':Ggrep ' : ':Glgrep ') . s:fnameescape(args)})
let tempfile = tempname() let tempfile = tempname()
if v:version > 704 | exe 'silent doautocmd <nomodeline> QuickFixCmdPre ' (listnr < 0 ? 'Ggrep' : 'Glgrep') | endif
exe '!' . escape(s:shellesc(cmd + args), '%#!') exe '!' . escape(s:shellesc(cmd + args), '%#!')
\ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile)) \ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile))
let list = map(readfile(tempfile), 's:GrepParseLine(prefix, name_only, dir, v:val)') let list = map(readfile(tempfile), 's:GrepParseLine(prefix, name_only, dir, v:val)')
call s:QuickfixSet(listnr, list, 'a') call s:QuickfixSet(listnr, list, 'a')
if v:version > 704 | exe 'silent doautocmd <nomodeline> QuickFixCmdPost ' (listnr < 0 ? 'Ggrep' : 'Glgrep') | endif
redraw
if !a:bang && !empty(list) if !a:bang && !empty(list)
call s:BlurStatus() call s:BlurStatus()
return (listnr < 0 ? 'c' : 'l').'first' . after return (listnr < 0 ? 'c' : 'l').'first' . after