mirror of
1
0
Fork 0

Improved the escaping when using the silver searcher (Ag)

This commit is contained in:
amix 2016-12-27 11:45:17 -03:00
parent 1494e2edfa
commit 04abc6907c
1 changed files with 2 additions and 2 deletions

View File

@ -383,11 +383,11 @@ function! VisualSelection(direction, extra_filter) range
let l:saved_reg = @" let l:saved_reg = @"
execute "normal! vgvy" execute "normal! vgvy"
let l:pattern = escape(@", '\\/.*$^~[]') let l:pattern = escape(@", "\\/.*'$^~[]")
let l:pattern = substitute(l:pattern, "\n$", "", "") let l:pattern = substitute(l:pattern, "\n$", "", "")
if a:direction == 'gv' if a:direction == 'gv'
call CmdLine("Ag \"" . l:pattern . "\" " ) call CmdLine("Ag '" . l:pattern . "' " )
elseif a:direction == 'replace' elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/') call CmdLine("%s" . '/'. l:pattern . '/')
endif endif