From 5c24c3c504de4564f6331d5c60609fdcad6d3ff1 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 24 Jun 2016 11:49:53 +0200 Subject: [PATCH] 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 ``` --- autoload/airline/extensions/ycm.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/ycm.vim b/autoload/airline/extensions/ycm.vim index dc44c0e..98defc5 100644 --- a/autoload/airline/extensions/ycm.vim +++ b/autoload/airline/extensions/ycm.vim @@ -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