diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index d077c9c..807d72d 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4095,7 +4095,6 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort endif let tree = s:Tree(dir) let args = a:args - let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? 'fugitive://' . dir . '//0/' : tree . '/') let name_only = s:HasOpt(args, '-l', '--files-with-matches', '--name-only', '-L', '--files-without-match') let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args if listnr > 0 @@ -4108,6 +4107,9 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort let tempfile = tempname() let event = listnr < 0 ? 'grep-fugitive' : 'lgrep-fugitive' silent exe s:DoAutocmd('QuickFixCmdPre ' . event) + let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? + \ 'fugitive://' . dir . '//0/' : + \ s:cpath(getcwd(), tree) ? '' : tree . '/') exe '!' . escape(s:UserCommand(dir, cmd + args), '%#!') \ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile)) let list = map(readfile(tempfile), 's:GrepParseLine(prefix, name_only, dir, v:val)')