Quote ripgrep arguments to be able to use special characters in regex

This commit is contained in:
Sebastian Humenda 2020-02-23 20:58:13 +01:00
parent ec87af6b69
commit 591fb00529

View file

@ -61,7 +61,9 @@ fun! s:RgSearch(txt)
if &smartcase == 1
let l:rgopts = l:rgopts . '-S '
endif
silent! exe 'grep! ' . l:rgopts . a:txt
" quote a:txt before sending it to the shell
let l:txt = substitute(a:txt, "'", "\\'", "g")
silent! exe 'grep! ' . l:rgopts . "'" . a:txt . "'"
if len(getqflist())
exe g:rg_window_location 'copen'
redraw!