mirror of
https://github.com/jremmen/vim-ripgrep.git
synced 2025-12-26 19:45:29 +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
|
||||
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!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue