From bf7cfb1d1f163417bff7a45d0473a9e2424b3187 Mon Sep 17 00:00:00 2001 From: Michael Sanders Date: Sun, 22 Mar 2009 19:35:50 -0400 Subject: [PATCH] fixed bug with special characters in placeholders --- plugin/snipMate.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/snipMate.vim b/plugin/snipMate.vim index 28cdbe8..2f12127 100644 --- a/plugin/snipMate.vim +++ b/plugin/snipMate.vim @@ -118,8 +118,8 @@ fun! TriggerSnippet() endif let word = matchstr(getline('.'), '\S\+\%'.col('.').'c') - for filetype in [bufnr('%')] + split(&ft, '\.') + ['_'] - let trigger = s:GetSnippet(word, filetype) + for scope in [bufnr('%')] + split(&ft, '\.') + ['_'] + let trigger = s:GetSnippet(word, scope) if exists('s:snippet') | break | endif endfor @@ -556,8 +556,8 @@ fun s:UpdateSnip(...) let i += 1 endif - call setline(pos[0], substitute(getline(pos[0]), '\%'.pos[1].'c'. - \ s:oldWord, newWord, '')) + call setline(pos[0], substitute(getline(pos[0]), '\%'.pos[1].'c\V'. + \ escape(s:oldWord, '\'), escape(newWord, '\'), '')) endfor if oldStartSnip != s:startSnip call cursor('.', startCol + s:startSnip - oldStartSnip)