Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 2da32565a73c0a9ab25d4fd9b0f6626336202d07 1 parent 964e4db
Peter Odding authored June 06, 2010

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  autoload.vim
7  autoload.vim
@@ -69,7 +69,12 @@ function! s:pattern_to_lnum(entry, pathname) " {{{2
69 69
      let contents = s:cached_contents[a:pathname]
70 70
     endif
71 71
     let pattern = substitute(a:entry.cmd, '^/\(.*\)/$', '\1', '')
72  
-    let index = match(contents, pattern)
  72
+    let pattern = substitute(pattern, '\~', '\\~', 'g')
  73
+    try
  74
+      let index = match(contents, pattern)
  75
+    catch
  76
+      throw "Failed pattern: " . string(pattern)
  77
+    endtry
73 78
     if index >= 0
74 79
       let lnum = index + 1
75 80
       let a:entry.cmd = string(lnum)

0 notes on commit 2da3256

Please sign in to comment.
Something went wrong with that request. Please try again.