Move python to optional dependencies since the vimrc is smart enough to disable those plugins when they aren't being used, add the msgpack requirement for deoplete, and don't load deoplete if msgpack isn't available

This commit is contained in:
Kevin MacMartin 2020-02-28 00:16:49 -05:00
parent dd9b823685
commit 948add4516
2 changed files with 27 additions and 13 deletions

View file

@ -8,14 +8,15 @@ A theme, config and collection of plugins for Vim.
* **Bash**: Required by the _update_ and _gentags_ scripts.
* **Coreutils**: Required by the _update_ script.
* **Git**: Required by the _update_ script and git-related plugins.
* **Python**: Required by the _deoplete_ and _MatchTagAlways_ plugins.
## Optional Requirements ##
* **Compilers, Linters and Runtimes**: The ale plugin can use compilers, linters and runtimes to provide real-time syntax checking.
* **CTags**: Required by the _tagbar_ and _deoplete_ plugins as well as the _gentags_ script ([ctags website](http://ctags.sourceforge.net)).
* **Powerline Fonts**: Required to enable the fancier looking status line ([powerline-fonts repo](https://github.com/Lokaltog/powerline-fonts)).
* **Neovim Python Module**: Required for _deoplete_ autocompletion
* **Python**: Required for _deoplete_ autocompletion and _MatchTagAlways_ functionality.
* **Neovim Python Module**: Required for _deoplete_ autocompletion.
* **Python Msgpack**: Required for _deoplete_ autocompletion.
## Distribution Features ##

35
vimrc
View file

@ -38,12 +38,13 @@
"Initialize Plugins:
let pathogen_disabled = []
"configure pythonx and the python_neovim variable to determine whether deoplete should be loaded
if has('python3')
"configure pythonx and check for the python-neovim and python-msgpack libraries if python3 is found
if !has('nvim')
set pyxversion=3
endif
"check for python-neovim
redir => python_neovim_check
silent python3 exec("import pkgutil\nneovim = pkgutil.find_loader('neovim')\nfound = neovim is not None\nprint(found)")
redir END
@ -53,29 +54,41 @@
else
let g:python_neovim = 0
endif
"check for python-msgpack
redir => python_msgpack_check
silent python3 exec("import pkgutil\nmsgpack = pkgutil.find_loader('msgpack')\nfound = msgpack is not None\nprint(found)")
redir END
if substitute(python_msgpack_check, '^\n*\([^\n]*\)\n*$', '\1', '') == 'True'
let g:python_msgpack = 1
else
let g:python_msgpack = 0
endif
else
let g:python_neovim = 0
endif
"disable incompatible/unnecessary plugins
if has('nvim')
call add(pathogen_disabled, 'vim-fixkey')
endif
if !has('python') && !has('python3')
"if python isn't available disable plugins that depend on it and set library variables to false
call add(pathogen_disabled, 'MatchTagAlways')
let g:python_neovim = 0
let g:python_msgpack = 0
endif
if !g:python_neovim
if !g:python_neovim || !g:python_msgpack
"don't load deoplete if either of its python dependencies are missing
call add(pathogen_disabled, 'deoplete.nvim')
call add(pathogen_disabled, 'neco-syntax')
call add(pathogen_disabled, 'nvim-yarp')
call add(pathogen_disabled, 'vim-hug-neovim-rpc')
elseif has('nvim')
"don't load the neovim compatibility plugins required by deoplete if actually running neovim
call add(pathogen_disabled, 'nvim-yarp')
call add(pathogen_disabled, 'vim-hug-neovim-rpc')
endif
"if neovim is being used we should disable plugins that aren't compatible or necessary
if has('nvim')
call add(pathogen_disabled, 'vim-fixkey')
endif
"use pathogen to load plugins that haven't been disabled
runtime bundle/vim-pathogen/autoload/pathogen.vim