aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/health/provider.vim56
-rw-r--r--runtime/doc/provider.txt23
2 files changed, 54 insertions, 25 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index bc6b2c074c..57dd508f96 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -221,20 +221,26 @@ endfunction
function! s:check_python(version) abort
call health#report_start('Python ' . a:version . ' provider')
- let python_bin_name = 'python'.(a:version == 2 ? '' : '3')
+ let pyname = 'python'.(a:version == 2 ? '' : '3')
let pyenv = resolve(exepath('pyenv'))
let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n'
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
- let host_prog_var = python_bin_name.'_host_prog'
+ let host_prog_var = pyname.'_host_prog'
+ let loaded_var = 'g:loaded_'.pyname.'_provider'
let python_bin = ''
let python_multiple = []
+ if exists(loaded_var) && !exists('*provider#'.pyname.'#Call')
+ call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
+ return
+ endif
+
if exists('g:'.host_prog_var)
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
endif
- let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
- if empty(python_bin_name)
+ let [pyname, pythonx_errs] = provider#pythonx#Detect(a:version)
+ if empty(pyname)
call health#report_warn('No Python interpreter was found with the neovim '
\ . 'module. Using the first available for diagnostics.')
if !empty(pythonx_errs)
@@ -242,21 +248,21 @@ function! s:check_python(version) abort
endif
endif
- if !empty(python_bin_name)
+ if !empty(pyname)
if exists('g:'.host_prog_var)
- let python_bin = exepath(python_bin_name)
+ let python_bin = exepath(pyname)
endif
- let python_bin_name = fnamemodify(python_bin_name, ':t')
+ let pyname = fnamemodify(pyname, ':t')
endif
if !empty(pythonx_errs)
call health#report_error('Python provider error', pythonx_errs)
endif
- if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs)
+ if !empty(pyname) && empty(python_bin) && empty(pythonx_errs)
if !exists('g:'.host_prog_var)
call health#report_info(printf('`g:%s` is not set. Searching for '
- \ . '%s in the environment.', host_prog_var, python_bin_name))
+ \ . '%s in the environment.', host_prog_var, pyname))
endif
if !empty(pyenv)
@@ -269,19 +275,19 @@ function! s:check_python(version) abort
call health#report_ok(printf('pyenv found: "%s"', pyenv))
endif
- let python_bin = s:trim(s:system([pyenv, 'which', python_bin_name], '', 1))
+ let python_bin = s:trim(s:system([pyenv, 'which', pyname], '', 1))
if empty(python_bin)
- call health#report_warn(printf('pyenv could not find %s.', python_bin_name))
+ call health#report_warn(printf('pyenv could not find %s.', pyname))
endif
endif
if empty(python_bin)
- let python_bin = exepath(python_bin_name)
+ let python_bin = exepath(pyname)
if exists('$PATH')
for path in split($PATH, has('win32') ? ';' : ':')
- let path_bin = path.'/'.python_bin_name
+ let path_bin = path.'/'.pyname
if path_bin != python_bin && index(python_multiple, path_bin) == -1
\ && executable(path_bin)
call add(python_multiple, path_bin)
@@ -292,7 +298,7 @@ function! s:check_python(version) abort
" This is worth noting since the user may install something
" that changes $PATH, like homebrew.
call health#report_info(printf('Multiple %s executables found. '
- \ . 'Set `g:%s` to avoid surprises.', python_bin_name, host_prog_var))
+ \ . 'Set `g:%s` to avoid surprises.', pyname, host_prog_var))
endif
if python_bin =~# '\<shims\>'
@@ -333,9 +339,9 @@ function! s:check_python(version) abort
endif
endif
- if empty(python_bin) && !empty(python_bin_name)
+ if empty(python_bin) && !empty(pyname)
" An error message should have already printed.
- call health#report_error(printf('`%s` was not found.', python_bin_name))
+ call health#report_error(printf('`%s` was not found.', pyname))
elseif !empty(python_bin) && !s:check_bin(python_bin)
let python_bin = ''
endif
@@ -349,7 +355,7 @@ function! s:check_python(version) abort
if $VIRTUAL_ENV != pyenv_prefix
let virtualenv_inactive = 1
endif
- elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/'
+ elseif !empty(pyname) && exepath(pyname) !~# '^'.$VIRTUAL_ENV.'/'
let virtualenv_inactive = 1
endif
endif
@@ -381,9 +387,9 @@ function! s:check_python(version) abort
call health#report_info('Python'.a:version.' version: ' . pyversion)
if s:is_bad_response(status)
- call health#report_info(printf('%s-neovim version: %s (%s)', python_bin_name, current, status))
+ call health#report_info(printf('%s-neovim version: %s (%s)', pyname, current, status))
else
- call health#report_info(printf('%s-neovim version: %s', python_bin_name, current))
+ call health#report_info(printf('%s-neovim version: %s', pyname, current))
endif
if s:is_bad_response(current)
@@ -397,10 +403,10 @@ function! s:check_python(version) abort
call health#report_error('HTTP request failed: '.latest)
elseif s:is_bad_response(status)
call health#report_warn(printf('Latest %s-neovim is NOT installed: %s',
- \ python_bin_name, latest))
+ \ pyname, latest))
elseif !s:is_bad_response(current)
call health#report_ok(printf('Latest %s-neovim is installed: %s',
- \ python_bin_name, latest))
+ \ pyname, latest))
endif
endif
@@ -409,6 +415,12 @@ endfunction
function! s:check_ruby() abort
call health#report_start('Ruby provider')
+ let loaded_var = 'g:loaded_ruby_provider'
+ if exists(loaded_var) && !exists('*provider#ruby#Call')
+ call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
+ return
+ endif
+
if !executable('ruby') || !executable('gem')
call health#report_warn(
\ "`ruby` and `gem` must be in $PATH.",
@@ -451,7 +463,7 @@ function! s:check_ruby() abort
\ current_gem, latest_gem),
\ ['Run in shell: gem update neovim'])
else
- call health#report_ok('Gem "neovim" is up-to-date: '. current_gem)
+ call health#report_ok('Latest "neovim" gem is installed: '. current_gem)
endif
endfunction
diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt
index 3cd53e3e50..ac4d7361f4 100644
--- a/runtime/doc/provider.txt
+++ b/runtime/doc/provider.txt
@@ -49,7 +49,8 @@ Note: The `--upgrade` flag ensures you have the latest version even if
PYTHON PROVIDER CONFIGURATION ~
*g:python_host_prog*
*g:python3_host_prog*
-Program to use for evaluating Python code. Setting this makes startup faster. >
+Program to use for evaluating Python code. Setting this makes startup faster.
+Also useful for working with virtualenvs. >
let g:python_host_prog = '/path/to/python'
let g:python3_host_prog = '/path/to/python3'
<
@@ -61,6 +62,23 @@ To disable Python 2 support: >
To disable Python 3 support: >
let g:loaded_python3_provider = 1
+PYTHON VIRTUALENVS ~
+
+If you plan to use per-project virtualenvs often, you should assign
+a virtualenv for Neovim and hard-code the interpreter path via
+|g:python_host_prog| (or |g:python3_host_prog|) so that the "neovim" python
+package is not required for each Environment. Example using pyenv: >
+ pyenv install 3.4.4
+ pyenv virtualenv 3.4.4 py3neovim
+ pyenv activate py3neovim
+ pip install neovim
+ pyenv which python # Note the path
+
+The last command reports the interpreter path. Add it to your init.vim: >
+ let g:python3_host_prog = '/full/path/to/py3neovim/bin/python'
+
+More information:
+https://github.com/zchee/deoplete-jedi/wiki/Setting-up-Python-for-Neovim
==============================================================================
Ruby integration *provider-ruby*
@@ -80,7 +98,6 @@ RUBY PROVIDER CONFIGURATION ~
To disable Ruby support: >
let g:loaded_ruby_provider = 1
-
==============================================================================
Clipboard integration *provider-clipboard* *clipboard*
@@ -93,7 +110,7 @@ are found in your `$PATH`.
- xclip
- xsel (newer alternative to xclip)
- - pbcopy/pbpaste (Mac OS X)
+ - pbcopy/pbpaste (macOS)
- lemonade (for SSH) https://github.com/pocke/lemonade
- doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/