From caa4291a9adb02ff99a6b4600f0b1d8a294f066b Mon Sep 17 00:00:00 2001 From: Val Markovic Date: Thu, 15 Dec 2016 21:21:35 -0800 Subject: [PATCH] Revert "Auto merge of #2473 - wincent:no-lazy, r=Valloric" This reverts commit c182c0529b1bc7faa7158ad88fcd5a2b1cf439d9, reversing changes made to 48b7ccef76c9f15b8fc0227b5e661eb55e483459. --- README.md | 13 ------------- plugin/youcompleteme.vim | 11 ++++++++++- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fc568057..3936b85c 100644 --- a/README.md +++ b/README.md @@ -2882,19 +2882,6 @@ executable first in your PATH when the virtual environment is active then if you set `g:ycm_python_binary_path` to just `'python'` it will be found as the first Python and used to run [JediHTTP][]. -### I want to defer loading of YouCompleteMe until after Vim finishes booting - -In recent versions of Vim, you can install YCM in a folder under -`~/.vim/pack/*/opt` and then load it once the user is idle via an autocommand: - -```viml -augroup load_ycm - autocmd! - autocmd CursorHold, CursorHoldI * :packadd YouCompleteMe - \ | autocmd! load_ycm -augroup END -``` - Contributor Code of Conduct --------------------------- diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index 5b37d515..ac0f88ab 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -128,7 +128,16 @@ let g:ycm_goto_buffer_command = let g:ycm_disable_for_files_larger_than_kb = \ get( g:, 'ycm_disable_for_files_larger_than_kb', 1000 ) -call youcompleteme#Enable() +" On-demand loading. Let's use the autoload folder and not slow down vim's +" startup procedure. +if has( 'vim_starting' ) " loading at startup + augroup youcompletemeStart + autocmd! + autocmd VimEnter * call youcompleteme#Enable() + augroup END +else " manual loading with :packadd + call youcompleteme#Enable() +endif " This is basic vim plugin boilerplate call s:restore_cpo()