1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2025-12-19 04:20:18 +01:00

fixed regression in backtick patch (snippets beginning with ` were no longer evaluated). ugly but it works

This commit is contained in:
msanders
2010-01-01 06:08:55 -05:00
parent 226f7b41cd
commit b2937829c0

View File

@@ -76,12 +76,12 @@ endf
fun s:ProcessSnippet(snip) fun s:ProcessSnippet(snip)
let snippet = a:snip let snippet = a:snip
" Evaluate eval (`...`) expressions. " Evaluate eval (`...`) expressions.
" Backquotes prefixed with a backslash are ignored. " Backquotes prefixed with a backslash "\" are ignored.
" Using a loop here instead of a regex fixes a bug with nested "\=". " Using a loop here instead of a regex fixes a bug with nested "\=".
if stridx(snippet, '`') != -1 if stridx(snippet, '`') != -1
while match(snippet, '[^\\]`.\{-}[^\\]`') != -1 while match(snippet, '\(^\|[^\\]\)`.\{-}[^\\]`') != -1
let snippet = substitute(snippet, '[^\\]\zs`.\{-}[^\\]`\ze', let snippet = substitute(snippet, '\(^\|[^\\]\)\zs`.\{-}[^\\]`\ze',
\ substitute(eval(matchstr(snippet, '[^\\]`\zs.\{-}[^\\]\ze`')), \ substitute(eval(matchstr(snippet, '\(^\|[^\\]\)`\zs.\{-}[^\\]\ze`')),
\ "\n\\%$", '', ''), '') \ "\n\\%$", '', ''), '')
endw endw
let snippet = substitute(snippet, "\r", "\n", 'g') let snippet = substitute(snippet, "\r", "\n", 'g')