@@ -2393,6 +2393,7 @@ function! s:GetGrepCommandParameters()
2393
2393
\ ' patternpost' : ' /' ,
2394
2394
\ ' wholewordpre' : ' \<' ,
2395
2395
\ ' wholewordpost' : ' \>' ,
2396
+ \ ' exclusionsmap' : ' ' ,
2396
2397
\ ' filtertargetsnofiles' : ' 0' ,
2397
2398
\ ' bufferdirsearchallowed' : ' 1' ,
2398
2399
\ ' backslashdir' : ' 0' ,
@@ -2409,6 +2410,7 @@ function! s:GetGrepCommandParameters()
2409
2410
\ ' patternpost' : ' "' ,
2410
2411
\ ' wholewordpre' : ' -w ' ,
2411
2412
\ ' wholewordpost' : ' ' ,
2413
+ \ ' exclusionsmap' : ' "--exclude=\"".v:val."\""." --exclude-dir=\"".v:val."\""' ,
2412
2414
\ ' filtertargetsnofiles' : ' 1' ,
2413
2415
\ ' bufferdirsearchallowed' : ' !recursive' ,
2414
2416
\ ' backslashdir' : ' 0' ,
@@ -2425,6 +2427,7 @@ function! s:GetGrepCommandParameters()
2425
2427
\ ' patternpost' : ' "' ,
2426
2428
\ ' wholewordpre' : ' -w ' ,
2427
2429
\ ' wholewordpost' : ' ' ,
2430
+ \ ' exclusionsmap' : ' ' ,
2428
2431
\ ' filtertargetsnofiles' : ' 1' ,
2429
2432
\ ' bufferdirsearchallowed' : ' 0' ,
2430
2433
\ ' backslashdir' : ' 0' ,
@@ -2441,6 +2444,7 @@ function! s:GetGrepCommandParameters()
2441
2444
\ ' patternpost' : ' "' ,
2442
2445
\ ' wholewordpre' : ' -w ' ,
2443
2446
\ ' wholewordpost' : ' ' ,
2447
+ \ ' exclusionsmap' : ' "--ignore-dir=\"".v:val."\""' ,
2444
2448
\ ' filtertargetsnofiles' : ' 1' ,
2445
2449
\ ' bufferdirsearchallowed' : ' 1' ,
2446
2450
\ ' backslashdir' : ' 0' ,
@@ -2457,6 +2461,7 @@ function! s:GetGrepCommandParameters()
2457
2461
\ ' patternpost' : ' ' ,
2458
2462
\ ' wholewordpre' : ' -w ' ,
2459
2463
\ ' wholewordpost' : ' ' ,
2464
+ \ ' exclusionsmap' : ' ' ,
2460
2465
\ ' filtertargetsnofiles' : ' 1' ,
2461
2466
\ ' bufferdirsearchallowed' : ' 1' ,
2462
2467
\ ' backslashdir' : ' 0' ,
@@ -2473,6 +2478,7 @@ function! s:GetGrepCommandParameters()
2473
2478
\ ' patternpost' : ' ' ,
2474
2479
\ ' wholewordpre' : ' "\<' ,
2475
2480
\ ' wholewordpost' : ' \>"' ,
2481
+ \ ' exclusionsmap' : ' ' ,
2476
2482
\ ' filtertargetsnofiles' : ' 1' ,
2477
2483
\ ' bufferdirsearchallowed' : ' 1' ,
2478
2484
\ ' backslashdir' : ' 1' ,
@@ -2558,6 +2564,11 @@ function! s:GetGrepCommandLine(pattern, add, wholeword, count, escapeArgs)
2558
2564
call map (fileTargetList, ' s:ForwardToBackSlash(v:val)' )
2559
2565
endif
2560
2566
2567
+ " Add exclusions
2568
+ if len (commandParams[" exclusionsmap" ])
2569
+ let opts .= " " . join (map (split (filesToExclude, ' ,' ), commandParams[" exclusionsmap" ]), ' ' ) . " "
2570
+ endif
2571
+
2561
2572
" Set extra inclusions and exclusions
2562
2573
if s: IsCommandGrep ()
2563
2574
" Specific inclusions are only set in recursive mode
@@ -2572,17 +2583,12 @@ function! s:GetGrepCommandLine(pattern, add, wholeword, count, escapeArgs)
2572
2583
let fileTargetList = [ s: GetCwdEscaped () ]
2573
2584
endif
2574
2585
endif
2575
-
2576
- let opts .= " " . join (map (split (filesToExclude, ' ,' ), ' "--exclude=\"".v:val."\""." --exclude-dir=\"".v:val."\""' ), ' ' )
2577
2586
elseif s: IsCommandAck ()
2578
2587
" Patch up the command line in a way that ack understands; do the
2579
2588
" following:
2580
2589
" 1) Replace a leading star with the current directory
2581
2590
" 2) Replace all trailing stars with a space
2582
2591
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."\""' ), ' ' )
2586
2592
endif
2587
2593
2588
2594
let filesToGrep = join (fileTargetList, ' ' )
0 commit comments