diff --git a/autoload/ack.vim b/autoload/ack.vim index dbf84572..a305a621 100644 --- a/autoload/ack.vim +++ b/autoload/ack.vim @@ -39,7 +39,14 @@ function! ack#Ack(cmd, args) "{{{ endif " If no pattern is provided, search for the word under the cursor - let l:grepargs = empty(a:args) ? expand("") : a:args . join(a:000, ' ') + if empty(a:args) + let l:grepargs = expand("") + " escape special chars in and wrap in ' + " use " instead of ', for 'xxx' will cause no effect on windows + let l:grepargs = '"' . escape(l:grepargs, '$') . '"' + else + let l:grepargs = a:args . join(a:000, ' ') + endif "Bypass search if cursor is on blank string if l:grepargs == ""