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.
This commit is contained in:
micbou 2019-01-22 13:10:46 +01:00
parent 113787cc20
commit 616c2a2964
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05

View File

@ -54,13 +54,22 @@ elseif !has( 'timers' )
\ echohl None \ echohl None
call s:restore_cpo() call s:restore_cpo()
finish finish
elseif !has( 'python' ) && !has( 'python3' ) elseif !has( 'python_compiled' ) && !has( 'python3_compiled' )
echohl WarningMsg | echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim compiled with " . \ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
\ "Python (2.7.1+ or 3.4+) support." | \ "Python (2.7.1+ or 3.4+) support." |
\ echohl None \ echohl None
call s:restore_cpo() call s:restore_cpo()
finish 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' elseif &encoding !~? 'utf-\?8'
echohl WarningMsg | echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires UTF-8 encoding. " . \ echomsg "YouCompleteMe unavailable: requires UTF-8 encoding. " .