Background
The Debian 11 vim
package doesn't include python3
support. See the section titled "No python support in Debian 11 vim - evidence" below
I need vim
with python3
support for the YouCompleteMe vim plugin. Syntax highlighting is also required. To build a new vim
, I downloaded the vim 9.0 tarball into /opt/
on my Debian 11 system and extracted it... explicitly:
$ cd /opt
$ sudo wget http://ftp.vim.org/pub/pub/vim/unix/vim-9.0.tar.bz2
$ sudo bunzip2 ./vim-9.0.tar.bz2
$ sudo chown -R mpenning:mpenning vim/
I built it with...
$ cd /opt/vim
$ ./configure \
--enable-python3interp=yes \
--with-python3-command=python3.9 \
--with-features=huge \
--with-compiledby="[email protected]"
$ make
$ sudo cp src/vim /usr/bin/vim
However, now I see these errors when I start vim
...
$ vim foo.py
2022-10-24 09:08:31 [INFO] Editing 'foo.py'.
failed to load colors/lists/default.vim
failed to load colors/lists/default.vim
Press ENTER or type command to continue
As one might expect, I get no vim
syntax highlighting when I see the errors listed above. Just for kicks, I tried this in my vim
session:
:syntax enable
:colorscheme default
:filetype plugin on
Predictably, that doesn't help.
Question
How can I build a Debian vim
binary with python3
and syntax highlighting support?
No python support in Debian 11 vim - evidence
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08)
Included patches: 1-2434
Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428
Modified by team [email protected]
Compiled by team [email protected]
Huge version without GUI. Features included ( ) or not (-):
acl -farsi mouse_sgr tag_binary
arabic file_in_path -mouse_sysmouse -tag_old_static
autocmd find_in_path mouse_urxvt -tag_any_white
autochdir float mouse_xterm -tcl
-autoservername folding multi_byte termguicolors
-balloon_eval -footer multi_lang terminal
balloon_eval_term fork() -mzscheme terminfo
-browse gettext netbeans_intg termresponse
builtin_terms -hangul_input num64 textobjects
byte_offset iconv packages textprop
channel insert_expand path_extra timers
cindent ipv6 -perl title
-clientserver job persistent_undo -toolbar
-clipboard jumplist popupwin user_commands
cmdline_compl keymap postscript vartabs
cmdline_hist lambda printer vertsplit
cmdline_info langmap profile virtualedit
comments libcall -python visual
conceal linebreak -python3 visualextra
cryptv lispindent quickfix viminfo
cscope listcmds reltime vreplace
cursorbind localmap rightleft wildignore
cursorshape -lua -ruby wildmenu
dialog_con menu scrollbind windows
diff mksession signs writebackup
digraphs modify_fname smartindent -X11
-dnd mouse -sound -xfontset
-ebcdic -mouseshape spell -xim
emacs_tags mouse_dec startuptime -xpm
eval mouse_gpm statusline -xsmp
ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
extra_search mouse_netterm syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-DtwDbo/vim-8.2.2434=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lacl -lattr -lgpm -ldl
$
CodePudding user response:
I need vim with python syntax highlighting
Python syntax highlighting is built-in so you don't need to build Vim manually to get it. You are wasting your and everyone's time.
"Python support" is unrelated to syntax highlighting. It refers to the Python scripting interface that allow users to (partially) write Vim plugins in Python. Having -python
or -python3
in :version
has zero incidence on Vim's ability to highlight Python.
FWIW, you don't have to build a new vim binary if you install the vim-nox
Debian package instead of depending on the vim
Debian package. vim-nox
embeds several scripting languages in the vim.nox
binary build.
CodePudding user response:
Debian 11 vim
most certainly supports Python 3:
$ cat /etc/issue
Debian GNU/Linux 11
$ vim --version | grep -F python
comments libcall -python visual
conceal linebreak python3 visualextra
The package to apt install
is vim
, not vim-tiny
, that's all.
CodePudding user response:
It seems that I have to set $VIMRUNTIME
to my new vim/runtime
source directory when I try to edit with the new vim
binary... Setting this in my ~/.bashrc
fixed the problem...
export VIMRUNTIME="/opt/vim/runtime/"
Now I have vim
with both python3
and functional syntax highlighting.