mirror of
https://github.com/amix/vimrc
synced 2025-06-16 17:45:00 +08:00
Improved the escaping when using the silver searcher (Ag)
This commit is contained in:
@ -383,11 +383,11 @@ function! VisualSelection(direction, extra_filter) range
|
||||
let l:saved_reg = @"
|
||||
execute "normal! vgvy"
|
||||
|
||||
let l:pattern = escape(@", '\\/.*$^~[]')
|
||||
let l:pattern = escape(@", "\\/.*'$^~[]")
|
||||
let l:pattern = substitute(l:pattern, "\n$", "", "")
|
||||
|
||||
if a:direction == 'gv'
|
||||
call CmdLine("Ag \"" . l:pattern . "\" " )
|
||||
call CmdLine("Ag '" . l:pattern . "' " )
|
||||
elseif a:direction == 'replace'
|
||||
call CmdLine("%s" . '/'. l:pattern . '/')
|
||||
endif
|
||||
|
Reference in New Issue
Block a user