Skip to content

Commit 9bd9435

Browse files
committed
Add '-' as an escaped character
Strings like -> would end up being interpreted by the underlying grep program as a command line flag.
1 parent 2612388 commit 9bd9435

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugin/EasyGrep.vim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,7 +2587,7 @@ function! s:ConfigureGrepCommandParameters()
25872587
\ 'opt_str_wholewordprefix': '',
25882588
\ 'opt_str_wholewordpostfix': '',
25892589
\ 'opt_str_wholewordoption': '-w ',
2590-
\ 'req_str_escapespecialcharacters': "\^$#.*[]",
2590+
\ 'req_str_escapespecialcharacters': "-\^$#.*[]",
25912591
\ 'opt_str_escapespecialcharacterstwice': "",
25922592
\ 'opt_str_mapexclusionsexpression': '"--exclude=\"".v:val."\""." --exclude-dir=\"".v:val."\""',
25932593
\ 'opt_bool_filtertargetswithnofiles': '1',
@@ -2611,7 +2611,7 @@ function! s:ConfigureGrepCommandParameters()
26112611
\ 'opt_str_wholewordprefix': '',
26122612
\ 'opt_str_wholewordpostfix': '',
26132613
\ 'opt_str_wholewordoption': '-w ',
2614-
\ 'req_str_escapespecialcharacters': "\^$#.*",
2614+
\ 'req_str_escapespecialcharacters': "-\^$#.*",
26152615
\ 'opt_str_escapespecialcharacterstwice': "",
26162616
\ 'opt_str_mapexclusionsexpression': '',
26172617
\ 'opt_bool_filtertargetswithnofiles': '1',
@@ -2634,7 +2634,7 @@ function! s:ConfigureGrepCommandParameters()
26342634
\ 'opt_str_wholewordprefix': '',
26352635
\ 'opt_str_wholewordpostfix': '',
26362636
\ 'opt_str_wholewordoption': '-w ',
2637-
\ 'req_str_escapespecialcharacters': "\^$#.*+?()[]{}",
2637+
\ 'req_str_escapespecialcharacters': "-\^$#.*+?()[]{}",
26382638
\ 'opt_str_escapespecialcharacterstwice': "|",
26392639
\ 'opt_str_mapexclusionsexpression': '"--ignore-dir=\"".v:val."\" --ignore-file=ext:\"".substitute(v:val, "\\*\\.", "", "")."\""',
26402640
\ 'opt_bool_filtertargetswithnofiles': '0',
@@ -2659,7 +2659,7 @@ function! s:ConfigureGrepCommandParameters()
26592659
\ 'opt_str_wholewordprefix': '',
26602660
\ 'opt_str_wholewordpostfix': '',
26612661
\ 'opt_str_wholewordoption': '-w ',
2662-
\ 'req_str_escapespecialcharacters': "\^$#.*+?()[]{}",
2662+
\ 'req_str_escapespecialcharacters': "-\^$#.*+?()[]{}",
26632663
\ 'opt_str_escapespecialcharacterstwice': "|",
26642664
\ 'opt_str_mapexclusionsexpression': '"--ignore-dir=\"".v:val."\""',
26652665
\ 'opt_bool_filtertargetswithnofiles': '1',
@@ -2682,7 +2682,7 @@ function! s:ConfigureGrepCommandParameters()
26822682
\ 'opt_str_wholewordprefix': '',
26832683
\ 'opt_str_wholewordpostfix': '',
26842684
\ 'opt_str_wholewordoption': '-w ',
2685-
\ 'req_str_escapespecialcharacters': "\^$#.*+?()[]{}",
2685+
\ 'req_str_escapespecialcharacters': "-\^$#.*+?()[]{}",
26862686
\ 'opt_str_escapespecialcharacterstwice': "",
26872687
\ 'opt_str_mapexclusionsexpression': '',
26882688
\ 'opt_bool_filtertargetswithnofiles': '1',
@@ -2952,7 +2952,7 @@ function! s:DoGrep(pattern, add, wholeword, count, escapeArgs)
29522952
" In some cases the colors of vim's layout might be borked, so force vim to redraw:
29532953
redraw!
29542954
if g:EasyGrepOpenWindowOnMatch
2955-
if g:EasyGrepWindow == 0
2955+
if g:EasyGrepWindow == 0
29562956
if !s:IsQuickfixListOpen()
29572957
execute g:EasyGrepWindowPosition." copen"
29582958
endif

0 commit comments

Comments
 (0)