From 616c2a2964feea213d829f5f1c946cd6fd73bd57 Mon Sep 17 00:00:00 2001 From: micbou Date: Tue, 22 Jan 2019 13:10:46 +0100 Subject: [PATCH] Improve error message when unable to load Python Check explicitely that Vim is compiled with Python support. Attempt to load Python 3 before Python 2 since only one can be loaded at a time on some platforms. Return an appropriate error if unable to load both. --- plugin/youcompleteme.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index 3cc57480..1f77e050 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -54,13 +54,22 @@ elseif !has( 'timers' ) \ echohl None call s:restore_cpo() finish -elseif !has( 'python' ) && !has( 'python3' ) +elseif !has( 'python_compiled' ) && !has( 'python3_compiled' ) echohl WarningMsg | \ echomsg "YouCompleteMe unavailable: requires Vim compiled with " . \ "Python (2.7.1+ or 3.4+) support." | \ echohl None call s:restore_cpo() finish +" These calls try to load the Python 2 and Python 3 libraries when Vim is +" compiled dynamically against them. Since only one can be loaded at a time on +" some platforms, we first check if Python 3 is available. +elseif !has( 'python3' ) && !has( 'python' ) + echohl WarningMsg | + \ echomsg "YouCompleteMe unavailable: unable to load Python." | + \ echohl None + call s:restore_cpo() + finish elseif &encoding !~? 'utf-\?8' echohl WarningMsg | \ echomsg "YouCompleteMe unavailable: requires UTF-8 encoding. " .