I too struck this issue after updating from Jessie to Stretch.
As noted in another answer, installing vim-nox
should resolve this issue (as vim-nox in Stretch is compiled against python2). However, I figured that python3 is the way of the future. So I decided to fix it another way.
If you need Python2 support, thisinstalling vim-nox
is probably the best method. Note that if you needstill have vim
installed, that will continue to completely remove allbe the default "vim
" on your system. If you wish to make vim-nox
packages first!default you need to do one of the following:
- completely remove
vim
; or - use
update-alternatives
to setvim-nox
as default "vim
"; or - just explicitly launch
vim-nox
, i.e.:vim.nox <filename>
.
I fixed mine by tweaking my existing .vim
plugin files. All that needs changing is swap out pyfile
command for py3file
:
for file in /home/user/.vim/bundle/custom/plugin/*.vim; do
sed -i "s|pyfile|py3file|" $file
done
(obviously my username is user
!:)
That solved most of the issues, but one of my .py
plugins then starting giving some different (python3) errors:
Error detected while processing /home/user/.vim/bundle/custom/plugin/rst.vim:
line 2:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/.vim/bundle/custom/plugin/rst.py", line 100
vim.command("let b:nestings = " + `self.nestings`)
^
SyntaxError: invalid syntax
So I used the 2to3
python tool to update that particular script to python3:
2to3 -w /home/user/.vim/bundle/custom/plugin/rst.py
All fixed! :)