diff options
author | cathook <b01902109@csie.ntu.edu.tw> | 2014-11-10 06:00:10 +0800 |
---|---|---|
committer | cathook <b01902109@csie.ntu.edu.tw> | 2014-11-10 06:00:10 +0800 |
commit | c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0 (patch) | |
tree | 0459cff93fb61c1b8fe9b8896ce2d409cb1607df /vim/plugin/shared_vim.vim | |
parent | fd1fbcecb1ef75fe8016ab909ae4092ca705b2f1 (diff) | |
download | vim-shrvim-c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0.tar vim-shrvim-c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0.tar.gz vim-shrvim-c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0.tar.bz2 vim-shrvim-c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0.tar.lz vim-shrvim-c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0.tar.xz vim-shrvim-c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0.tar.zst vim-shrvim-c42a1c6bb78dd2ed11c43085e9a748a8c8342fc0.zip |
Adds python/python3 check in shared_vim.vim
Diffstat (limited to 'vim/plugin/shared_vim.vim')
-rw-r--r-- | vim/plugin/shared_vim.vim | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/vim/plugin/shared_vim.vim b/vim/plugin/shared_vim.vim index 3b949d7..7b93340 100644 --- a/vim/plugin/shared_vim.vim +++ b/vim/plugin/shared_vim.vim @@ -1,3 +1,33 @@ + + +function! SharedVimUsePython2() + if has('python') + command! -nargs=* SharedVimPython python <args> + let s:shared_vim_python_version = 2 + else + echoerr 'The command python is not supported by this version of vim' + endif +endfunc + + +function! SharedVimUsePython3() + if has('python3') + command! -nargs=* SharedVimPython python3 <args> + let s:shared_vim_python_version = 3 + else + echoerr 'The command python3 is not supported by this version of vim' + endif +endfunc + + +let s:shared_vim_python_version = -1 +if has('python3') + call SharedVimUsePython3() +elseif has('python') + call SharedVimUsePython2() +endif + + function! SharedVimConnect(server_name, port, identity) let b:shared_vim_server_name = a:server_name let b:shared_vim_port = a:port @@ -16,7 +46,11 @@ endfunction function! SharedVimSync() -python << EOF + if s:shared_vim_python_version < 0 + echoerr 'No python command.' + return 0 + endif +SharedVimPython << EOF import bisect import json import re @@ -742,6 +776,7 @@ def main(): main() EOF let b:shared_vim_init = 0 + return 1 endfunction |