diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 59a264f6..4c6152d2 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -61,12 +61,12 @@ function! youcompleteme#Enable() call s:SetUpSigns() call s:SetUpSyntaxHighlighting() - call youcompleteme#EnableCursorMovedAutocommands() if g:ycm_allow_changing_updatetime && &updatetime > 2000 set ut=2000 endif + call youcompleteme#EnableCursorMovedAutocommands() augroup youcompleteme autocmd! " Note that these events will NOT trigger for the file vim is started with; @@ -92,6 +92,21 @@ function! youcompleteme#Enable() endfunction +function youcompleteme#EnableCursorMovedAutocommands() + augroup ycmcompletemecursormove + autocmd! + autocmd CursorMovedI * call s:OnCursorMovedInsertMode() + autocmd CursorMoved * call s:OnCursorMovedNormalMode() + augroup END +endfunction + + +function youcompleteme#DisableCursorMovedAutocommands() + autocmd! ycmcompletemecursormove CursorMoved * + autocmd! ycmcompletemecursormove CursorMovedI * +endfunction + + function! s:SetUpPython() abort py import sys py import vim @@ -808,18 +823,6 @@ endfunction command! YcmDiags call s:ShowDiagnostics() -function youcompleteme#EnableCursorMovedAutocommands() - augroup ycmcompletemecursormove - autocmd! - autocmd CursorMovedI * call s:OnCursorMovedInsertMode() - autocmd CursorMoved * call s:OnCursorMovedNormalMode() - augroup END -endfunction - -function youcompleteme#DisableCursorMovedAutocommands() - autocmd! ycmcompletemecursormove CursorMoved * - autocmd! ycmcompletemecursormove CursorMovedI * -endfunction " This is basic vim plugin boilerplate let &cpo = s:save_cpo