Compile and install vim8 under centos7, and support python3

Keywords: vim git Python CentOS

1. Install python3

vim7.4 and python2.7 are installed by default in CentOS 7. Now we want to install vim8 and make it support python3.

First of all, you need to install python3 in the system. For specific installation steps, please refer to my previous blog: https://blog.csdn.net/geerniya/article/details/79263846

2. Compile and install vim8

Enter the installation directory:

cd /usr/local/share

Get source file:

git clone https://github.com/vim/vim.git

At this time, through the ls command, you can find that the vim directory already exists in the directory
Enter this directory:

cd vim

Enter src file

cd src

Set up

./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--enable-python3interp=yes \  
--prefix=/usr/local/vim8

Build and install:

make
make install

The installation is successful.

How to see the vim version status is as follows:

vim --version

As follows:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 25 2018 12:24:35)
//Include patches: 1-1638
//Compiled by root@localhost.localdomain
//The giant version has no graphical interface. May use (+)And not available(-)Function:
+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              +vertsplit
-clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               -ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
     //System vimrc file: "$VIM/vimrc"
     //User vimrc file: "$HOME/.vimrc"
 //Second user vimrc file: "~/.vim/vimrc"
      //User exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
         $VIM Preset value: "/usr/local/share/vim"
//Compilation method: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
//Link mode: gcc   -L/usr/local/lib -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -ldl     -L/usr/local/python3/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm      

We can see that it supports python3, but it does not support python2. That is to say, vim can only support one version of Python.

Next, you can customize the configuration plug-in. Please refer to my next blog.

Posted by ltd on Tue, 31 Mar 2020 05:04:47 -0700