Skip to content

Commit 6fd2fa5

Browse files
committed
Add exclusionsmap parameter
1 parent 28fe286 commit 6fd2fa5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

plugin/EasyGrep.vim

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,6 +2393,7 @@ function! s:GetGrepCommandParameters()
23932393
\ 'patternpost': '/',
23942394
\ 'wholewordpre': '\<',
23952395
\ 'wholewordpost': '\>',
2396+
\ 'exclusionsmap': '',
23962397
\ 'filtertargetsnofiles': '0',
23972398
\ 'bufferdirsearchallowed': '1',
23982399
\ 'backslashdir': '0',
@@ -2409,6 +2410,7 @@ function! s:GetGrepCommandParameters()
24092410
\ 'patternpost': '"',
24102411
\ 'wholewordpre': '-w ',
24112412
\ 'wholewordpost': '',
2413+
\ 'exclusionsmap': '"--exclude=\"".v:val."\""." --exclude-dir=\"".v:val."\""',
24122414
\ 'filtertargetsnofiles': '1',
24132415
\ 'bufferdirsearchallowed': '!recursive',
24142416
\ 'backslashdir': '0',
@@ -2425,6 +2427,7 @@ function! s:GetGrepCommandParameters()
24252427
\ 'patternpost': '"',
24262428
\ 'wholewordpre': '-w ',
24272429
\ 'wholewordpost': '',
2430+
\ 'exclusionsmap': '',
24282431
\ 'filtertargetsnofiles': '1',
24292432
\ 'bufferdirsearchallowed': '0',
24302433
\ 'backslashdir': '0',
@@ -2441,6 +2444,7 @@ function! s:GetGrepCommandParameters()
24412444
\ 'patternpost': '"',
24422445
\ 'wholewordpre': '-w ',
24432446
\ 'wholewordpost': '',
2447+
\ 'exclusionsmap': '"--ignore-dir=\"".v:val."\""',
24442448
\ 'filtertargetsnofiles': '1',
24452449
\ 'bufferdirsearchallowed': '1',
24462450
\ 'backslashdir': '0',
@@ -2457,6 +2461,7 @@ function! s:GetGrepCommandParameters()
24572461
\ 'patternpost': '',
24582462
\ 'wholewordpre': '-w ',
24592463
\ 'wholewordpost': '',
2464+
\ 'exclusionsmap': '',
24602465
\ 'filtertargetsnofiles': '1',
24612466
\ 'bufferdirsearchallowed': '1',
24622467
\ 'backslashdir': '0',
@@ -2473,6 +2478,7 @@ function! s:GetGrepCommandParameters()
24732478
\ 'patternpost': '',
24742479
\ 'wholewordpre': '"\<',
24752480
\ 'wholewordpost': '\>"',
2481+
\ 'exclusionsmap': '',
24762482
\ 'filtertargetsnofiles': '1',
24772483
\ 'bufferdirsearchallowed': '1',
24782484
\ 'backslashdir': '1',
@@ -2558,6 +2564,11 @@ function! s:GetGrepCommandLine(pattern, add, wholeword, count, escapeArgs)
25582564
call map(fileTargetList, 's:ForwardToBackSlash(v:val)')
25592565
endif
25602566

2567+
" Add exclusions
2568+
if len(commandParams["exclusionsmap"])
2569+
let opts .= " " . join(map(split(filesToExclude, ','), commandParams["exclusionsmap"]), ' ') . " "
2570+
endif
2571+
25612572
" Set extra inclusions and exclusions
25622573
if s:IsCommandGrep()
25632574
" Specific inclusions are only set in recursive mode
@@ -2572,17 +2583,12 @@ function! s:GetGrepCommandLine(pattern, add, wholeword, count, escapeArgs)
25722583
let fileTargetList = [ s:GetCwdEscaped() ]
25732584
endif
25742585
endif
2575-
2576-
let opts .= " " . join(map(split(filesToExclude, ','), '"--exclude=\"".v:val."\""." --exclude-dir=\"".v:val."\""'), ' ')
25772586
elseif s:IsCommandAck()
25782587
" Patch up the command line in a way that ack understands; do the
25792588
" following:
25802589
" 1) Replace a leading star with the current directory
25812590
" 2) Replace all trailing stars with a space
25822591
call map(fileTargetList, 'substitute(substitute(v:val, "^\\*$", s:GetCwdEscaped(), ""), "\\(.*\\)/\\*$", s:GetCwdEscaped()."/\\1", "")')
2583-
2584-
" Add exclusions
2585-
let opts .= " " . join(map(split(filesToExclude, ','), '"--ignore-dir=\"".v:val."\""'), ' ')
25862592
endif
25872593

25882594
let filesToGrep = join(fileTargetList, ' ')

0 commit comments

Comments
 (0)