diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2015-03-21 07:55:39 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2015-04-21 06:20:23 +0900 |
commit | 42de617974b6befaf5d25037bf6d92c2b889068b (patch) | |
tree | 3145cd37e5937ae3f6d000c02b8b146f2678fb81 /runtime/autoload/provider/python.vim | |
parent | 84891f2802a0db1a257580f341d70a5fdb0f6c75 (diff) | |
download | rneovim-42de617974b6befaf5d25037bf6d92c2b889068b.tar.gz rneovim-42de617974b6befaf5d25037bf6d92c2b889068b.tar.bz2 rneovim-42de617974b6befaf5d25037bf6d92c2b889068b.zip |
Add if_python3 support
Reviewed-by: Michael Reed <m.reed@mykolab.com>, Daniel Hahler <github@thequod.de>
Helped-by: Daniel Hahler <github@thequod.de>
Diffstat (limited to 'runtime/autoload/provider/python.vim')
-rw-r--r-- | runtime/autoload/provider/python.vim | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim index 53b984dfe2..4c43c8a613 100644 --- a/runtime/autoload/provider/python.vim +++ b/runtime/autoload/provider/python.vim @@ -1,28 +1,46 @@ -" The python provider uses a python host to emulate an environment for running -" python-vim plugins(:h python-vim). See :h nvim-providers for more -" information. +" The Python provider uses a Python host to emulate an environment for running +" python-vim plugins. See ":help nvim-provider" for more information. " -" Associating the plugin with the python host is the first step because plugins +" Associating the plugin with the Python host is the first step because plugins " will be passed as command-line arguments -if exists('s:loaded_python_provider') || &cp + +if exists('g:loaded_python_provider') + finish +endif +let g:loaded_python_provider = 1 + +let [s:prog, s:err] = provider#pythonx#Detect(2) +if s:prog == '' + " Detection failed finish endif -let s:loaded_python_provider = 1 + +function! provider#python#Prog() + return s:prog +endfunction + +function! provider#python#Error() + return s:err +endfunction + let s:plugin_path = expand('<sfile>:p:h').'/script_host.py' -" The python provider plugin will run in a separate instance of the python + +" The Python provider plugin will run in a separate instance of the Python " host. call remote#host#RegisterClone('legacy-python-provider', 'python') call remote#host#RegisterPlugin('legacy-python-provider', s:plugin_path, []) -" Ensure that we can load the python host before bootstrapping -try - let s:host = remote#host#Require('legacy-python-provider') -catch - echomsg v:exception - finish -endtry - -let s:rpcrequest = function('rpcrequest') function! provider#python#Call(method, args) + if !exists('s:host') + let s:rpcrequest = function('rpcrequest') + + " Ensure that we can load the Python host before bootstrapping + try + let s:host = remote#host#Require('legacy-python-provider') + catch + echomsg v:exception + finish + endtry + endif return call(s:rpcrequest, insert(insert(a:args, 'python_'.a:method), s:host)) endfunction |