mirror of
https://github.com/jremmen/vim-ripgrep.git
synced 2026-05-11 17:35:54 +08:00
Quote ripgrep arguments to be able to use special characters in regex
This commit is contained in:
parent
ec87af6b69
commit
591fb00529
1 changed files with 3 additions and 1 deletions
|
|
@ -61,7 +61,9 @@ fun! s:RgSearch(txt)
|
||||||
if &smartcase == 1
|
if &smartcase == 1
|
||||||
let l:rgopts = l:rgopts . '-S '
|
let l:rgopts = l:rgopts . '-S '
|
||||||
endif
|
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())
|
if len(getqflist())
|
||||||
exe g:rg_window_location 'copen'
|
exe g:rg_window_location 'copen'
|
||||||
redraw!
|
redraw!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue