添加python支持到vim
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了添加python支持到vim相关的知识,希望对你有一定的参考价值。
所以,我已经尝试了here的说明,但它们似乎没有用。一个问题可能是指令中指定的config目录是错误的,所以我将配置指令更改为
cd ~
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge
--enable-multibyte
--enable-rubyinterp=yes
--enable-pythoninterp=yes
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu
--enable-python3interp=yes
--with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu
--enable-perlinterp=yes
--enable-luainterp=yes
--enable-gui=gtk2
--enable-cscope
--prefix=/usr/local
make VIMRUNTIMEDIR=/usr/local/share/vim/vim80
这准确地反映了我的配置目录。我还验证了我的命令行安装了python和python3,但是,我不确定它们是否与我提供的配置文件中使用的版本相同,并且不知道如何检查。
当我输入vim --version
时,我得到以下输出:
vim $ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 2 2018 14:51:11)
Included patches: 1-137
Compiled by zane@tiki
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_sgr -tag_any_white
+arabic +file_in_path -mouse_sysmouse -tcl
+autocmd +find_in_path +mouse_urxvt +termguicolors
-autoservername +float +mouse_xterm +terminal
-balloon_eval +folding +multi_byte +terminfo
+balloon_eval_term -footer +multi_lang +termresponse
-browse +fork() -mzscheme +textobjects
++builtin_terms +gettext +netbeans_intg +timers
+byte_offset -hangul_input +num64 +title
+channel +iconv +packages -toolbar
+cindent +insert_expand +path_extra +user_commands
-clientserver +job -perl +vartabs
-clipboard +jumplist +persistent_undo +vertsplit
+cmdline_compl +keymap +postscript +virtualedit
+cmdline_hist +lambda +printer +visual
+cmdline_info +langmap +profile +visualextra
+comments +libcall +python/dyn +viminfo
+conceal +linebreak +python3/dyn +vreplace
+cryptv +lispindent +quickfix +wildignore
+cscope +listcmds +reltime +wildmenu
+cursorbind +localmap +rightleft +windows
+cursorshape -lua -ruby +writebackup
+dialog_con +menu +scrollbind -X11
+diff +mksession +signs -xfontset
+digraphs +modify_fname +smartindent -xim
-dnd +mouse +startuptime -xpm
-ebcdic -mouseshape +statusline -xsmp
+emacs_tags +mouse_dec -sun_workshop -xterm_clipboard
+eval -mouse_gpm +syntax -xterm_save
+ex_extra -mouse_jsbterm +tag_binary
+extra_search +mouse_netterm +tag_old_static
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/local/share/vim"
f-b for $VIMRUNTIME: "/usr/local/share/vim/vim80"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lnsl -ldl
您可以看到动态检查python(即使我不想这样,但不知道如何更改它)。当我尝试:echo has('python')
或:echo has('python3')
时,两人都回来了0
。
我想知道如何用python正确安装vim以及我做错了什么。
答案
我需要安装python-dev和python3-dev
为了方便:
sudo apt install python-dev python3-dev -yqq
以上是关于添加python支持到vim的主要内容,如果未能解决你的问题,请参考以下文章