diff --git a/plugin/vim-ripgrep.vim b/plugin/vim-ripgrep.vim index 9bc029d..deb255f 100644 --- a/plugin/vim-ripgrep.vim +++ b/plugin/vim-ripgrep.vim @@ -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!