mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Support :Ggrep --no-index/--no-cached
This commit is contained in:
@@ -5241,8 +5241,9 @@ let s:grep_combine_flags = '[aiIrhHEGPFnlLzocpWq]\{-\}'
|
|||||||
function! s:GrepOptions(args, dir) abort
|
function! s:GrepOptions(args, dir) abort
|
||||||
let options = {'name_only': 0, 'name_count': 0, 'line_number': 0}
|
let options = {'name_only': 0, 'name_count': 0, 'line_number': 0}
|
||||||
let tree = s:Tree(a:dir)
|
let tree = s:Tree(a:dir)
|
||||||
let options.prefix = empty(tree) ? fugitive#Find(':0:', a:dir) :
|
let prefix = empty(tree) ? fugitive#Find(':0:', a:dir) :
|
||||||
\ s:cpath(getcwd(), tree) ? '' : FugitiveVimPath(tree . '/')
|
\ s:cpath(getcwd(), tree) ? '' : FugitiveVimPath(tree . '/')
|
||||||
|
let options.prefix = prefix
|
||||||
for arg in a:args
|
for arg in a:args
|
||||||
if arg ==# '--'
|
if arg ==# '--'
|
||||||
break
|
break
|
||||||
@@ -5260,6 +5261,8 @@ function! s:GrepOptions(args, dir) abort
|
|||||||
endif
|
endif
|
||||||
if arg ==# '--cached'
|
if arg ==# '--cached'
|
||||||
let options.prefix = fugitive#Find(':0:', a:dir)
|
let options.prefix = fugitive#Find(':0:', a:dir)
|
||||||
|
elseif arg ==# '--no-cached'
|
||||||
|
let options.prefix = prefix
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
return options
|
return options
|
||||||
@@ -5317,7 +5320,6 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort
|
|||||||
if !handle
|
if !handle
|
||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
exe s:DirCheck(a:options)
|
|
||||||
let listnr = a:line1 == 0 ? a:line1 : a:line2
|
let listnr = a:line1 == 0 ? a:line1 : a:line2
|
||||||
let cmd = ['grep', '-n', '--no-color', '--full-name']
|
let cmd = ['grep', '-n', '--no-color', '--full-name']
|
||||||
let dir = s:Dir(a:options)
|
let dir = s:Dir(a:options)
|
||||||
@@ -5336,7 +5338,7 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort
|
|||||||
\ 'args': cmd + args,
|
\ 'args': cmd + args,
|
||||||
\ 'dir': s:GitDir(a:options),
|
\ 'dir': s:GitDir(a:options),
|
||||||
\ 'git_dir': s:GitDir(a:options),
|
\ 'git_dir': s:GitDir(a:options),
|
||||||
\ 'cwd': s:UserCommandCwd(dir),
|
\ 'cwd': s:UserCommandCwd(a:options),
|
||||||
\ 'filetype': 'git',
|
\ 'filetype': 'git',
|
||||||
\ 'mods': s:Mods(a:mods),
|
\ 'mods': s:Mods(a:mods),
|
||||||
\ 'file': s:Resolve(tempfile)}
|
\ 'file': s:Resolve(tempfile)}
|
||||||
|
|||||||
Reference in New Issue
Block a user