diff options
Diffstat (limited to 'runtime/autoload/provider/pythonx.vim')
-rw-r--r-- | runtime/autoload/provider/pythonx.vim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 022ef19914..05815a4896 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -5,6 +5,32 @@ endif let s:loaded_pythonx_provider = 1 +function! provider#pythonx#Require(host) abort + let ver = (a:host.orig_name ==# 'python') ? 2 : 3 + + " Python host arguments + let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()'] + + " Collect registered Python plugins into args + let python_plugins = remote#host#PluginsForHost(a:host.name) + for plugin in python_plugins + call add(args, plugin.path) + endfor + + try + let channel_id = rpcstart((ver == '2' ? + \ provider#python#Prog() : provider#python3#Prog()), args) + if rpcrequest(channel_id, 'poll') == 'ok' + return channel_id + endif + catch + echomsg v:throwpoint + echomsg v:exception + endtry + throw remote#host#LoadErrorForHost(a:host.orig_name, + \ '$NVIM_PYTHON_LOG_FILE') +endfunction + function! provider#pythonx#Detect(major_ver) abort let host_var = (a:major_ver == 2) ? \ 'g:python_host_prog' : 'g:python3_host_prog' |