From 71038e83f138e9cc4e8499900756ead015aaa588 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 21 Jan 2020 15:27:59 -0500 Subject: [PATCH] Try to use relative path for :Ggrep References https://github.com/tpope/vim-fugitive/issues/1439 --- autoload/fugitive.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)')