Skip to content

Commit 28fe286

Browse files
committed
Parameterize commands as to whether they support exclusions
1 parent 07653d6 commit 28fe286

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugin/EasyGrep.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ function! s:CreateOptionsString()
15361536
"call add(s:Options, "\"Current Directory: ".s:GetCwdEscaped())
15371537
call add(s:Options, "\"Grep Targets: ".join(s:GetFileTargetList(0), ' '))
15381538
call add(s:Options, "\"Inclusions: ".(!empty(g:EasyGrepFilesToInclude) ? g:EasyGrepFilesToInclude : "none"))
1539-
call add(s:Options, "\"Exclusions: ".(!empty(g:EasyGrepFilesToExclude) ? g:EasyGrepFilesToExclude : "none").(empty(g:EasyGrepFilesToExclude) || s:CommandSupportsExclusions() ? "" : " (only supported with vimgrep or a grepprg of 'ack' or 'grep' )"))
1539+
call add(s:Options, "\"Exclusions: ".(!empty(g:EasyGrepFilesToExclude) ? g:EasyGrepFilesToExclude : "none").(empty(g:EasyGrepFilesToExclude) || s:CommandSupportsExclusions() ? "" : " (not supported with grepprg='".s:GetGrepProgramName()."')"))
15401540
call add(s:Options, "")
15411541

15421542
endfunction
@@ -2346,7 +2346,8 @@ endfunction
23462346
"}}}
23472347
" CommandSupportsExclusions {{{
23482348
function! s:CommandSupportsExclusions()
2349-
return s:IsCommandAck() || s:IsCommandGrep() || s:IsCommandVimgrep()
2349+
let commandParams = s:GetGrepCommandParameters()
2350+
return commandParams["supportsexclusions"] == 1
23502351
endfunction
23512352
"}}}
23522353
" IsCommandVimgrep {{{
@@ -2384,6 +2385,7 @@ function! s:GetGrepCommandParameters()
23842385

23852386
if s:IsCommandVimgrep()
23862387
return {
2388+
\ 'supportsexclusions': '1',
23872389
\ 'recurse': '',
23882390
\ 'caseignore': '',
23892391
\ 'casematch': '',
@@ -2399,6 +2401,7 @@ function! s:GetGrepCommandParameters()
23992401
\ }
24002402
elseif s:IsCommandGrep()
24012403
return {
2404+
\ 'supportsexclusions': '1',
24022405
\ 'recurse': '-R',
24032406
\ 'caseignore': '-i',
24042407
\ 'casematch': '',
@@ -2414,6 +2417,7 @@ function! s:GetGrepCommandParameters()
24142417
\ }
24152418
elseif s:IsCommandGitGrep()
24162419
return {
2420+
\ 'supportsexclusions': '0',
24172421
\ 'recurse': '-R',
24182422
\ 'caseignore': '-i',
24192423
\ 'casematch': '',
@@ -2429,6 +2433,7 @@ function! s:GetGrepCommandParameters()
24292433
\ }
24302434
elseif s:IsCommandAck()
24312435
return {
2436+
\ 'supportsexclusions': '1',
24322437
\ 'recurse': '',
24332438
\ 'caseignore': '-i',
24342439
\ 'casematch': '',
@@ -2444,6 +2449,7 @@ function! s:GetGrepCommandParameters()
24442449
\ }
24452450
elseif s:IsCommandPt()
24462451
return {
2452+
\ 'supportsexclusions': '0',
24472453
\ 'recurse': '',
24482454
\ 'caseignore': '-i',
24492455
\ 'casematch': '',
@@ -2459,6 +2465,7 @@ function! s:GetGrepCommandParameters()
24592465
\ }
24602466
elseif s:IsCommandFindstr()
24612467
return {
2468+
\ 'supportsexclusions': '0',
24622469
\ 'recurse': '/S',
24632470
\ 'caseignore': '/I',
24642471
\ 'casematch': '/i',

0 commit comments

Comments
 (0)