call YCM function only if they are defined

fixes #1187 by making sure, we only call functions, that actually exist.

Should make vim-airline work with lady loaded YCM, e.g. using vim-plug:

```viml
" Code to execute when the plugin is loaded on demand
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
```
This commit is contained in:
Christian Brabandt 2016-06-24 11:49:53 +02:00
parent 64f06309b1
commit 5c24c3c504
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ function! airline#extensions#ycm#init(ext)
endfunction
function! airline#extensions#ycm#get_error_count()
if exists(':YcmDiag')
if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount")
let cnt = youcompleteme#GetErrorCount()
if cnt != 0
@ -23,7 +23,7 @@ function! airline#extensions#ycm#get_error_count()
endfunction
function! airline#extensions#ycm#get_warning_count()
if exists(':YcmDiag')
if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount")
let cnt = youcompleteme#GetWarningCount()
if cnt != 0