From b2937829c0ac5efe32717f02dd48b0f8c9bddac7 Mon Sep 17 00:00:00 2001 From: msanders Date: Fri, 1 Jan 2010 06:08:55 -0500 Subject: [PATCH] fixed regression in backtick patch (snippets beginning with ` were no longer evaluated). ugly but it works --- autoload/snipMate.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload/snipMate.vim b/autoload/snipMate.vim index 2213227..0ad5a58 100644 --- a/autoload/snipMate.vim +++ b/autoload/snipMate.vim @@ -75,13 +75,13 @@ endf " Prepare snippet to be processed by s:BuildTabStops fun s:ProcessSnippet(snip) let snippet = a:snip - " Evaluate eval (`...`) expressions. - " Backquotes prefixed with a backslash are ignored. + " Evaluate eval (`...`) expressions. + " Backquotes prefixed with a backslash "\" are ignored. " Using a loop here instead of a regex fixes a bug with nested "\=". if stridx(snippet, '`') != -1 - while match(snippet, '[^\\]`.\{-}[^\\]`') != -1 - let snippet = substitute(snippet, '[^\\]\zs`.\{-}[^\\]`\ze', - \ substitute(eval(matchstr(snippet, '[^\\]`\zs.\{-}[^\\]\ze`')), + while match(snippet, '\(^\|[^\\]\)`.\{-}[^\\]`') != -1 + let snippet = substitute(snippet, '\(^\|[^\\]\)\zs`.\{-}[^\\]`\ze', + \ substitute(eval(matchstr(snippet, '\(^\|[^\\]\)`\zs.\{-}[^\\]\ze`')), \ "\n\\%$", '', ''), '') endw let snippet = substitute(snippet, "\r", "\n", 'g')