From 8db937bb3b903ca2126caed7c59efa977d6e9648 Mon Sep 17 00:00:00 2001 From: Michael Sanders Date: Wed, 25 Feb 2009 17:50:59 -0500 Subject: [PATCH] fixed a bug when expanding snippets --- plugin/snipMate.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/snipMate.vim b/plugin/snipMate.vim index 407d87f..08da985 100644 --- a/plugin/snipMate.vim +++ b/plugin/snipMate.vim @@ -130,7 +130,7 @@ fun! TriggerSnippet() return unl s:snippet " if user cancelled multi snippet, quit endif let col = col('.')-len(word) - sil exe 's/'.word.'\%#//' + sil exe 's/'.escape(word, '/\*[]').'\%#//' return s:ExpandSnippet(col) endif return exists('s:sid') ? {s:sid}_SuperTab('n') : "\" @@ -150,9 +150,10 @@ fun s:GetSnippet() let s:snippet = s:ChooseSnippet(&ft, word) elseif exists('s:multi_snips["_"]["'.word.'"]') let s:snippet = s:ChooseSnippet('_', word) + else + if match(origWord, '\W') == -1 | break | en + let origWord = substitute(origWord, '.\{-}\W', '', '') en - if match(origWord, '\W') == -1 | break | en - let origWord = substitute(origWord, '.\{-}\W', '', '') endw return origWord endf