Conflicts between neovim a python vim plugin
Description:
Long story short: neovim and python-black are conflicting. python-black deploys /usr/share/vim/vimfiles/plugin/black.vim, neomvim tries to read it and fails. So whenever you open neovim you see this error:
Error detected while processing /usr/share/vim/vimfiles/plugin/black.vim[22]../usr/share/nvim/runtime/autoload/provider/python3.vim:
line 13:
E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/version.lua:177: attempt to index local 'version' (a nil value)
stack traceback:
/usr/share/nvim/runtime/lua/vim/version.lua:177: in function '_version'
/usr/share/nvim/runtime/lua/vim/version.lua:379: in function 'cmp'
/usr/share/nvim/runtime/lua/vim/version.lua:411: in function 'lt'
/usr/share/nvim/runtime/lua/vim/provider/python.lua:50: in function 'check_for_module'
/usr/share/nvim/runtime/lua/vim/provider/python.lua:89: in function </usr/share/nvim/runtime/lua/vim/provider/python.lua:80>
The longer story: the whole debug story is available on the forum
Additional info:
- package version(s):
- neovim 0.10.1-2
- python-black-24.4.2-2
- config: no config, default after fresh install
Steps to reproduce:
sudo pacman -Syu neovim python-blacknvim
Thoughts
I'm not sure if it's a ArchLinux packaging issue or an upstream issue with one of the packages or just an incompatibility between both packages. I'm not sure if neovim should try to read vim plugins, but sounds like a retro-compatibility. I don't think there is an upstream neovim issue to look at here. On the other hand, why python-black wouldn't have the right to deploy a black plugin for vim? I don't think there is an upstream python-black issue either. To me, it just looks like python-vim legitimately deploys a vim plugin, then neovim legitimately tries to read it for retro-compatibility with vim reasons and fail.
Idea of solution
As far as I understand (I may be wrong), there is no "bug" it's just that vim and neovim beings different there are not 100% compatible so neovim failing to read a vim plugin sounds normal. So in the end it's just an incompatibility between the black vim plugin and neovim. It's an issue because the plugin is autoloaded by neovim.
Based on the thoughts I just exposed above, my idea of solution is the following.
In python-black package, make a split package: python-black to deploy the whole python black stuff and something like python-black-vim-plugin to deploy the black vim plugin (which is currently done here: https://gitlab.archlinux.org/archlinux/packaging/packages/python-black/-/blob/main/PKGBUILD?ref_type=heads#L66-67). python-black-vim-plugin would then depend on python-black, and python-black would have an optional dependency for python-black-vim-plugin (optdepends=('python-black-vim-plugin: for black support in Vim'). Then on python-black-vim-plugin there would have conflicts=('neovim') and on neovim conflicts=('python-black-vim-plugin'). This way anyone can still have python-black and neovim without conflict.
That's what I would do. In the end you may prefer other solutions like, no shipping the black vim plugin anymore, or tweaking neovim default config to stop loading vim plugins, etc.