背景
Debian 11 vim包不包括python3支持。请参阅下面题为“Debian 11 vim中没有python支持-证据”一节。
我需要vim和python3对YouCompleteMe vim插件的支持。语法突出显示也是必需的。为了构建一个新的vim,我在我的Debian 11系统上下载了vim9.0 tarball到/opt/中,并提取了它.明文规定:
$ 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/我用..。
$ cd /opt/vim
$ ./configure \
--enable-python3interp=yes \
--with-python3-command=python3.9 \
--with-features=huge \
--with-compiledby="mike@pennington.net"
$ make
$ sudo cp src/vim /usr/bin/vim然而,当我启动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正如人们可能预期的那样,当我看到上面列出的错误时,我没有得到vim语法的突出显示。只是为了好玩,我在我的vim会话中尝试了这个:
:syntax enable:colorscheme default:filetype plugin on不出所料,这于事无补。
问题
如何构建具有python3和语法突出显示支持的Debian vim二进制文件?
Debian 11 vim中没有python支持-证据
$ 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+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
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
$发布于 2022-10-24 15:59:19
我需要带有python语法突出显示的vim。
Python语法突出显示是内置的,因此您不需要手动构建Vim来获得它。你在浪费你和每个人的时间。
"Python支持“与语法突出显示无关。它引用了Python脚本接口,它允许用户(部分)用Python编写Vim插件。-python或-python3在:version中的使用与Vim突出Python的能力无关。
FWIW,如果安装vim-nox Debian包而不是依赖于vim Debian包,则不必构建新的vim二进制文件。vim-nox在vim.nox二进制构建中嵌入了几种脚本语言。
发布于 2022-10-24 16:44:49
当我尝试使用新的$VIMRUNTIME二进制文件进行编辑时,似乎必须将vim/runtime设置为新的vim源目录.在我的~/.bashrc中设置这个解决了问题..。
export VIMRUNTIME="/opt/vim/runtime/"现在我有了vim,python3和函数式语法高亮显示。
https://stackoverflow.com/questions/74182575
复制相似问题