yegappan/grep

Search patterns with quotes are incorrectly shellescape()'d

Opened this issue · 3 comments

A quoted search expression, e.g. :Ack "Error code", fails as follows:

|| [Search results for '"Error']                                                              
zsh|1| unmatched "

Notice it is searching for "Error instead of "Error code".

Maybe use <arg>? I believe that handles shell quoting in the normal manner.

May want to check how ack.vim is able to handle quoted arguments correctly.

https://github.com/mileszs/ack.vim/blob/36e40f9ec91bdbf6f1adf408522a73a6925c3042/autoload/ack.vim#L50-L52

Opened PR #10 to fix this issue.

FYI: Same problem, using ag/(f)grep to find
'foobar = foo(bar)'
yields:
1 || [Search results for ''\''foobar'] 2 || /bin/bash: -c: line 0: syntax error near unexpected token('
3 || /bin/bash: -c: line 0: ag --vimgrep -riF ''\''foobar' = foo(bar)' *' 4 || [Search command exited with status 1]