From 238e9375005a476af14b92d41447cb18daf88358 Mon Sep 17 00:00:00 2001 From: Michael Sanders Date: Thu, 26 Mar 2009 00:21:04 -0400 Subject: [PATCH] added a cleaner fix for supertab --- plugin/snipMate.vim | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/plugin/snipMate.vim b/plugin/snipMate.vim index 5855d1f..790c041 100644 --- a/plugin/snipMate.vim +++ b/plugin/snipMate.vim @@ -119,17 +119,21 @@ fun! GetSnippets(dir) endf fun! TriggerSnippet() + if exists('g:SuperTabMappingForward') + if g:SuperTabMappingForward == "" + let g:SuperTabKey = "\" + elseif g:SuperTabMappingBackward == "" + let g:SuperTabKey = '\' + endif + endif + if pumvisible() " Update snippet if completion is used, or deal with supertab - if exists('s:sid') - return exists('b:complType') ? b:complType : "\" + if exists('g:SuperTabKey') + call feedkeys(g:SuperTabKey) | return '' endif call feedkeys("\a", 'n') " Close completion menu call feedkeys("\") | return '' endif - if !exists('s:sid') && exists('g:SuperTabMappingForward') - \ && g:SuperTabMappingForward == "" - call s:GetSuperTabSID() - endif if exists('g:snipPos') | return snipMate#jumpTabStop() | endif @@ -148,14 +152,7 @@ fun! TriggerSnippet() sil exe 's/'.escape(trigger, '.^$/\*[]').'\%#//' return snipMate#expandSnip(col) endif - return exists('s:sid') ? {s:sid}_SuperTab('n') : "\" -endf - -fun s:GetSuperTabSID() - let old = @a - redir @a | sil exe 'fun /SuperTab$' | redir END - let s:sid = matchstr(@a, '\d\+\ze_SuperTab(command)') - let @a = old + return exists('g:SuperTabKey') ? g:SuperTabKey : "\" endf " Check if word under cursor is snippet trigger; if it isn't, try checking if