From 551695de7626c4a0fd3b53e99cf07341ab849b50 Mon Sep 17 00:00:00 2001 From: Klein Florian Date: Thu, 16 Feb 2012 10:26:35 +0100 Subject: [PATCH] fix override of completefunc option --- plugin/symfonycomplete.vim | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugin/symfonycomplete.vim b/plugin/symfonycomplete.vim index 4dec6cf..d47b935 100644 --- a/plugin/symfonycomplete.vim +++ b/plugin/symfonycomplete.vim @@ -65,10 +65,23 @@ fun! CompleteSymfony(findstart, base) return res endfun -set completefunc=CompleteSymfony + +" activate completefunc only in twig, php, xml and yaml buffers +let oldcompletefunc = &completefunc + +au BufEnter *.twig setlocal completefunc=CompleteSymfony +au BufEnter *.php setlocal completefunc=CompleteSymfony +au BufEnter *.yml setlocal completefunc=CompleteSymfony +au BufEnter *.xml setlocal completefunc=CompleteSymfony + +" once leaved these buffers, switch back to the old completefunc, if any +au BufLeave *.twig setlocal completefunc=oldcompletefunc +au BufLeave *.php setlocal completefunc=oldcompletefunc +au BufLeave *.yml setlocal completefunc=oldcompletefunc +au BufLeave *.xml setlocal completefunc=oldcompletefunc + " Open console - let g:symfony_enable_shell_cmd = g:symfony_app_console_caller." ".g:symfony_app_console_path." -s" if(g:symfony_enable_shell_mapping == 1)