1

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 [email protected]
Compiled by [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
$
1
  • 2
    I think the vim-gtk and vim-gtk3 packages should come with Python support. I don't have a Debian system so I can't test it, but that's what the package description says. That's probably easier than building your own version. Oct 24, 2022 at 19:05

1 Answer 1

0

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 the vim startup errors are gone and I have vim with both python3 / functional syntax highlighting.

2
  • 4
    Using ./configure --prefix=/opt/vim should work as well; that's probably the better solution. Then you can just make install it too, instead of manually copying the files. Oct 24, 2022 at 19:02
  • 2
    Agreed with @MartinTournoij; the issue is that you used sudo cp vim … instead of make install, which does more than just copy the binary (you probably want the runtime support)
    – D. Ben Knoble
    Jul 21, 2023 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.