mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 06:13:51 -05:00
Try to use relative path for :Ggrep
References https://github.com/tpope/vim-fugitive/issues/1439
This commit is contained in:
@@ -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)')
|
||||
|
||||
Reference in New Issue
Block a user