1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2026-01-03 20:34:18 +01:00

fixed a bug when expanding snippets

This commit is contained in:
Michael Sanders
2009-02-25 17:50:59 -05:00
parent 979da19541
commit 8db937bb3b

View File

@@ -130,7 +130,7 @@ fun! TriggerSnippet()
return unl s:snippet " if user cancelled multi snippet, quit return unl s:snippet " if user cancelled multi snippet, quit
endif endif
let col = col('.')-len(word) let col = col('.')-len(word)
sil exe 's/'.word.'\%#//' sil exe 's/'.escape(word, '/\*[]').'\%#//'
return s:ExpandSnippet(col) return s:ExpandSnippet(col)
endif endif
return exists('s:sid') ? {s:sid}_SuperTab('n') : "\<tab>" return exists('s:sid') ? {s:sid}_SuperTab('n') : "\<tab>"
@@ -150,9 +150,10 @@ fun s:GetSnippet()
let s:snippet = s:ChooseSnippet(&ft, word) let s:snippet = s:ChooseSnippet(&ft, word)
elseif exists('s:multi_snips["_"]["'.word.'"]') elseif exists('s:multi_snips["_"]["'.word.'"]')
let s:snippet = s:ChooseSnippet('_', word) let s:snippet = s:ChooseSnippet('_', word)
else
if match(origWord, '\W') == -1 | break | en
let origWord = substitute(origWord, '.\{-}\W', '', '')
en en
if match(origWord, '\W') == -1 | break | en
let origWord = substitute(origWord, '.\{-}\W', '', '')
endw endw
return origWord return origWord
endf endf