From 43c94de3c297d2699af8dcc302d4a8dd95e49876 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Mon, 21 Jan 2013 17:34:49 -0800 Subject: [PATCH] Gracefully checking for ycm_core on load If the user hasn't compiled ycm_core, then a warning message is printed out. --- plugin/youcompleteme.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index 4be9777e..6b5081cd 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -29,6 +29,26 @@ elseif !has( 'python' ) finish endif +let s:script_folder_path = escape( expand( ':p:h' ), '\' ) + +function! s:HasYcmCore() + let path_prefix = s:script_folder_path . '/../python/' + if filereadable(path_prefix . 'ycm_core.so') + return 1 + elseif filereadable(path_prefix . 'ycm_core.dll') + return 1 + endif + return 0 +endfunction + +if !s:HasYcmCore() + echohl WarningMsg | + \ echomsg "ycm_core.[so|dll] not detected; you need to compile YCM " . + \ "before using it. Read the docs!" | + \ echohl None + finish +endif + let g:loaded_youcompleteme = 1 let g:ycm_min_num_of_chars_for_completion =