jremmen / vim-ripgrep

Use RipGrep in Vim and display results in a quickfix list
MIT License
542 stars 99 forks source link

escape vertical bars (`|`) in keywords #17

Closed kyoh86 closed 6 years ago

kyoh86 commented 6 years ago

Searching some words in Rg with a following command, I cannot found any lines.

:Rg 'OWNER|NAME'

Even though some lines contain "OWNER" or "NAME"... Tried to get logs, I found a line of problem.

:!./rg --vimgrep 'OWNER 2>&1| tee /var/folders/1z/271lqzy54m51c2y_bjt5n4h00000gn/T/vlLCT7l/1

A vertical bar (|) is mistakenly construed as a pipe. So in keywords, bars should be escaped. Yes, it can be done manually, but it's nonsense I think.

jremmen commented 6 years ago

Thanks for the PR. I think manually escaping is the right way to search when using a pipe, or any other character with special meaning. If Rg has a way to auto escape a search then I think maybe that could be something to look into enabling.