From 0441a03bb9bfc2a9c2c2b784470c17c5653a29e3 Mon Sep 17 00:00:00 2001 From: Israel Chauca Fuentes Date: Sat, 14 Aug 2010 20:34:25 -0500 Subject: [PATCH] Don't use #Finish() until completion has been used. --- plugin/delimitMate.vim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugin/delimitMate.vim b/plugin/delimitMate.vim index 3213ca8..42f23d1 100644 --- a/plugin/delimitMate.vim +++ b/plugin/delimitMate.vim @@ -268,10 +268,18 @@ function! s:DelimitMateSwitch() "{{{ endif endfunction "}}} +function! s:Finish() + if exists('g:delimitMate_loaded') + return delimitMate#Finish() + endif + return '' +endfunction + function! s:FlushBuffer() if exists('g:delimitMate_loaded') - call delimitMate#FlushBuffer() + return delimitMate#FlushBuffer() endif + return '' endfunction "}}} @@ -337,14 +345,14 @@ function! s:ExtraMappings() "{{{ inoremap delimitMateDel =delimitMate#Del() " Flush the char buffer on movement keystrokes or when leaving insert mode: for map in ['Esc', 'Left', 'Right', 'Home', 'End'] - exec 'inoremap delimitMate'.map.' =delimitMate#Finish()<'.map.'>' + exec 'inoremap delimitMate'.map.' =Finish()<'.map.'>' if !hasmapto('delimitMate'.map, 'i') exec 'silent! imap <'.map.'> delimitMate'.map endif endfor " Except when pop-up menu is active: for map in ['Up', 'Down', 'PageUp', 'PageDown', 'S-Down', 'S-Up'] - exec 'inoremap delimitMate'.map.' pumvisible() ? "\<'.map.'>" : "=delimitMate#Finish()<'.map.'>"' + exec 'inoremap delimitMate'.map.' pumvisible() ? "\<'.map.'>" : "=Finish()<'.map.'>"' if !hasmapto('delimitMate'.map, 'i') exec 'silent! imap <'.map.'> delimitMate'.map endif