ack.vim icon indicating copy to clipboard operation
ack.vim copied to clipboard

escape special chars in `<cword>` when run `:Ack<CR>`

Open FuDesign2008 opened this issue 7 years ago • 2 comments

In javascript / php, $ is valid in a variable.

function $sayHello () {}

If we run :Ack<CR> when cursor is under $sayHello, nothing will be found.

So try to escape $ and wrap <cword> in ' .

FuDesign2008 avatar Jan 30 '18 03:01 FuDesign2008

I wonder if shellescape or fnameescape might help?

benknoble avatar May 30 '19 23:05 benknoble

  1. This commit is only fix for the word that includes $, is not a universal solution.
  2. The source file has following comment. I'm not familiar with vimscript and can't find a better solution.
  " NOTE: we escape special chars, but not everything using shellescape to
  "       allow for passing arguments etc

FuDesign2008 avatar Jun 20 '19 07:06 FuDesign2008