diff options
| author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-23 08:27:17 -0300 |
|---|---|---|
| committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-23 08:27:17 -0300 |
| commit | 04e098fc3c485eaa6d323e9121e9c81215d94a87 (patch) | |
| tree | 6baa4183e8a40f6687a8825f4dde662ae650075c /runtime/autoload/provider/python3.vim | |
| parent | 0bd72fcae1071d1a5583af31f29e2223925044bc (diff) | |
| parent | 577d9f3f7e41cd2ac4813a35832bb2550c31a481 (diff) | |
| download | rneovim-04e098fc3c485eaa6d323e9121e9c81215d94a87.tar.gz rneovim-04e098fc3c485eaa6d323e9121e9c81215d94a87.tar.bz2 rneovim-04e098fc3c485eaa6d323e9121e9c81215d94a87.zip | |
Merge PR #2208 'if_python3 support'
Diffstat (limited to 'runtime/autoload/provider/python3.vim')
| -rw-r--r-- | runtime/autoload/provider/python3.vim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim new file mode 100644 index 0000000000..1a52ade0ef --- /dev/null +++ b/runtime/autoload/provider/python3.vim @@ -0,0 +1,47 @@ +" The Python3 provider uses a Python3 host to emulate an environment for running +" python3 plugins. See ":help nvim-provider" for more information. +" +" Associating the plugin with the Python3 host is the first step because +" plugins will be passed as command-line arguments + +if exists('g:loaded_python3_provider') + finish +endif +let g:loaded_python3_provider = 1 + +let [s:prog, s:err] = provider#pythonx#Detect(3) +if s:prog == '' + " Detection failed + finish +endif + +function! provider#python3#Prog() + return s:prog +endfunction + +function! provider#python3#Error() + return s:err +endfunction + +let s:plugin_path = expand('<sfile>:p:h').'/script_host.py' + +" The Python3 provider plugin will run in a separate instance of the Python3 +" host. +call remote#host#RegisterClone('legacy-python3-provider', 'python3') +call remote#host#RegisterPlugin('legacy-python3-provider', s:plugin_path, []) + +function! provider#python3#Call(method, args) + if !exists('s:host') + let s:rpcrequest = function('rpcrequest') + + " Ensure that we can load the Python3 host before bootstrapping + try + let s:host = remote#host#Require('legacy-python3-provider') + catch + echomsg v:exception + finish + endtry + endif + + return call(s:rpcrequest, insert(insert(a:args, 'python_'.a:method), s:host)) +endfunction |