Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug fix: Escape ~ in tag search patterns
There's probably more characters I'm supposed to escape. Ideally I would
just prefix \V to every search pattern like the Vim documentation
describes but I couldn't get this to work consistently :-(
  • Loading branch information
xolox committed Jun 6, 2010
1 parent 964e4db commit 2da3256
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion autoload.vim
Expand Up @@ -69,7 +69,12 @@ function! s:pattern_to_lnum(entry, pathname) " {{{2
let contents = s:cached_contents[a:pathname]
endif
let pattern = substitute(a:entry.cmd, '^/\(.*\)/$', '\1', '')
let index = match(contents, pattern)
let pattern = substitute(pattern, '\~', '\\~', 'g')
try
let index = match(contents, pattern)
catch
throw "Failed pattern: " . string(pattern)
endtry
if index >= 0
let lnum = index + 1
let a:entry.cmd = string(lnum)
Expand Down

0 comments on commit 2da3256

Please sign in to comment.