@@ -470,11 +470,12 @@ function! s:SetGrepRoot(...)
470
470
else
471
471
let lst = [ " Select grep root: " ]
472
472
call extend (lst, [ " 1. 'cwd' (search from the current directory)" ])
473
- call extend (lst, [ " 2. 'repository' (alias for '" .s: EasyGrepRepositoryList ." ')" ])
474
- call extend (lst, [ " 3. A specific directory" ])
473
+ call extend (lst, [ " 2. 'search' (search from a dynamic root)" ])
474
+ call extend (lst, [ " 3. 'repository' (alias for '" .s: EasyGrepRepositoryList ." ')" ])
475
+ call extend (lst, [ " 4. 'directory' (search from a specific directory)" ])
475
476
476
- let numFixedItems = 3
477
- let upperLimit = 4
477
+ let numFixedItems = 4
478
+ let upperLimit = numFixedItems + 1
478
479
if exists (" s:EasyGrepRootHistory" )
479
480
let numAdditional = len (s: EasyGrepRootHistory )
480
481
for dir in s: EasyGrepRootHistory
@@ -490,8 +491,14 @@ function! s:SetGrepRoot(...)
490
491
elseif grepRootNumChoice == 1
491
492
let grepRootChoice = " cwd"
492
493
elseif grepRootNumChoice == 2
493
- let grepRootChoice = " repository"
494
+ let grepRootChoice = input (" Enter a pattern for the dynamic root (comma separated): " , " " )
495
+ if empty (grepRootChoice)
496
+ return
497
+ endif
498
+ let grepRootChoice = " search:" .grepRootChoice
494
499
elseif grepRootNumChoice == 3
500
+ let grepRootChoice = " repository"
501
+ elseif grepRootNumChoice == 4
495
502
let grepRootChoice = input (" Enter a directory to set the root to: " , " " , " dir" )
496
503
if empty (grepRootChoice)
497
504
return
@@ -593,7 +600,7 @@ function! s:GetGrepRootEx()
593
600
elseif isdirectory (g: EasyGrepRoot )
594
601
" Trim a trailing slash
595
602
let g: EasyGrepRoot = substitute (g: EasyGrepRoot , " /$" , " " , " " )
596
- let fullRootPath = fnamemodify (g: EasyGrepRoot , " :p" )
603
+ let fullRootPath = substitute ( fnamemodify (g: EasyGrepRoot , " :p" ), " /$ " , " " , " " )
597
604
if g: EasyGrepRoot [0 ] == ' /' && g: EasyGrepRoot != fullRootPath
598
605
let g: EasyGrepRoot = fullRootPath
599
606
elseif match (g: EasyGrepRoot , " \\ ./" , 0 ) != 0 && g: EasyGrepRoot != fullRootPath
@@ -606,7 +613,7 @@ function! s:GetGrepRootEx()
606
613
endif
607
614
608
615
if ! empty (errorstring)
609
- call s: Error (errorstring." for g:EasyGrepRoot '" .g: EasyGrepRoot ." '; acking as if cwd" )
616
+ call s: Error (errorstring." for g:EasyGrepRoot '" .g: EasyGrepRoot ." '; acting as if cwd" )
610
617
endif
611
618
call s: Log (" GetGrepRootEx returned " .pathtoreturn)
612
619
return [pathtoreturn, empty (errorstring), type ]
0 commit comments