Skip to content

Commit

Permalink
Improved the escaping when using the silver searcher (Ag)
Browse files Browse the repository at this point in the history
  • Loading branch information
amix committed Dec 27, 2016
1 parent 1494e2e commit 04abc69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vimrcs/basic.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 04abc69

Please sign in to comment.