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