mirror of
https://github.com/gryf/snipmate.vim.git
synced 2025-12-18 20:10:18 +01:00
fixed regression in backtick patch (snippets beginning with ` were no longer evaluated). ugly but it works
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user