Favor :Ggrep over :Git grep

I'm starting to think :Git grep shouldn't be special cased.
Occasionally it is desirable to see grep results without clobbering the
quickfix list.

Reserve -O/--open-files-in-pager to opt into quickfix behavior, as this
fits well with Fugitive's use of a temp buffer as the Git pager.
This commit is contained in:
Tim Pope
2020-04-08 02:36:17 -04:00
parent f5391f0bfc
commit 85e2c73830
3 changed files with 7 additions and 4 deletions

View File

@@ -4136,6 +4136,9 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort
endif
let tree = s:Tree(dir)
let args = a:options.args
if get(args, 0, '') =~# '^-O\|--open-files-in-pager$'
let args = args[1:-1]
endif
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