diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 19232222..a06c5705 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -30,7 +30,7 @@ function! youcompleteme#Enable() augroup youcompleteme autocmd! autocmd CursorMovedI * call s:OnMovedI() - autocmd BufRead,BufEnter * call s:SetCompleteFunc() + autocmd BufRead,BufEnter * call s:OnBufferVisit() autocmd CursorHold,CursorHoldI * py csystem.AddBufferIdentifiers() augroup END @@ -64,6 +64,12 @@ function! youcompleteme#Enable() endfunction +function! s:OnBufferVisit() + call s:SetCompleteFunc() + py csystem.AddBufferIdentifiers() +endfunction + + function! s:SetCompleteFunc() let &completefunc = 'youcompleteme#Complete' let &l:completefunc = 'youcompleteme#Complete'