{"action":"created","issue":{"url":"https://api.github.com/repos/junegunn/vim-plug/issues/149","labels_url":"https://api.github.com/repos/junegunn/vim-plug/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/junegunn/vim-plug/issues/149/comments","events_url":"https://api.github.com/repos/junegunn/vim-plug/issues/149/events","html_url":"https://github.com/junegunn/vim-plug/issues/149","id":54728973,"number":149,"title":"On demand loading doesn't work with YouCompleteMe","user":{"login":"vicaya","id":11239,"avatar_url":"https://avatars.githubusercontent.com/u/11239?v=3","gravatar_id":"","url":"https://api.github.com/users/vicaya","html_url":"https://github.com/vicaya","followers_url":"https://api.github.com/users/vicaya/followers","following_url":"https://api.github.com/users/vicaya/following{/other_user}","gists_url":"https://api.github.com/users/vicaya/gists{/gist_id}","starred_url":"https://api.github.com/users/vicaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicaya/subscriptions","organizations_url":"https://api.github.com/users/vicaya/orgs","repos_url":"https://api.github.com/users/vicaya/repos","events_url":"https://api.github.com/users/vicaya/events{/privacy}","received_events_url":"https://api.github.com/users/vicaya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-19T05:59:47Z","updated_at":"2015-01-19T06:53:48Z","closed_at":null,"body":"YouCompleteMe is quite heavy (causes an extra 180ms in loading time on a fast i7 machine; much slower on older machines). I'd like to have it load on demand. Here is what I found:\r\n\r\nIf I use 'on' command, I get something like the following, no matter which ycm command I try:\r\n```\r\nError detected while processing function <SNR>2_lod_cmd:\r\nline    2:\r\nE492: Not an editor command: YcmCompleter\r\n```\r\nIf I use 'L' to load YouCompleteMe in the PlugStatus page, it'll show the plugin as OK but the YCM commands will not be available with error messages like this:\r\n```\r\nE492: Not an editor command: YcmCompleter\r\n```\r\nIt seems to work with 'for' filetype triggers on startup (e.g. vim whatever.ch if I have 'on': 'chill') only. It doesn't work with ':e whatever.ch' though, so I can't load the plugin during a session."},"comment":{"url":"https://api.github.com/repos/junegunn/vim-plug/issues/comments/70452738","html_url":"https://github.com/junegunn/vim-plug/issues/149#issuecomment-70452738","issue_url":"https://api.github.com/repos/junegunn/vim-plug/issues/149","id":70452738,"user":{"login":"junegunn","id":700826,"avatar_url":"https://avatars.githubusercontent.com/u/700826?v=3","gravatar_id":"","url":"https://api.github.com/users/junegunn","html_url":"https://github.com/junegunn","followers_url":"https://api.github.com/users/junegunn/followers","following_url":"https://api.github.com/users/junegunn/following{/other_user}","gists_url":"https://api.github.com/users/junegunn/gists{/gist_id}","starred_url":"https://api.github.com/users/junegunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junegunn/subscriptions","organizations_url":"https://api.github.com/users/junegunn/orgs","repos_url":"https://api.github.com/users/junegunn/repos","events_url":"https://api.github.com/users/junegunn/events{/privacy}","received_events_url":"https://api.github.com/users/junegunn/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T06:53:47Z","updated_at":"2015-01-19T06:53:47Z","body":"That's probably because YCM calls `youcompleteme#Enable()` only during `VimEnter`. So if you want to load it after Vim started, you have to manually call that function. The following example shows how you can defer loading of YCM until you enter insert mode.\r\n\r\nhttps://github.com/junegunn/vim-plug/wiki/faq#loading-plugins-manually\r\n\r\nIf you want to load it on a specific command, you have to define your own proxy command like follows (I haven't checked if it really works, but you'll get the idea)\r\n\r\n```vim\r\nPlug 'Valloric/YouCompleteMe', { 'on': [] }\r\ncommand! YcmCompleter call plug#load('YouCompleteMe') | call youcompleteme#Enable() | YcmCompleter\r\n```"}}