On CentOS 7 compile and install Vim8 support python3
1. Uninstall the original vim.
yum remove vim-*
Install its dependencies
yum install git -y
yum install gcc gcc-c++ -y
yum install ncurses-devel -y
yum install python3 python3-devel -y
Here only installed python3 needed to support dependent. If you need additional support, but also need to install additional corresponding dependence.
Compile and install Vim8
git clone --depth 1 https://github.com/vim/vim ~/vim
cd ~/vim
./configure --with-features=huge \
--enable-multibyte \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local/vim
make
sudo make install
rm -rf ~/vim
Note that vim be installed in / usr / local / vim directory, it is not necessary to delete the directory directly.
Here is the explanation for some configurations:
Configuration Options | Explanation |
---|---|
--with-features=huge | Support up properties |
--enable-pythoninterp | Turn on support for plug-ins written in python |
--enable-python3interp | Turn on support for plug-ins written python3 |
--enable-rubyinterp | Turn on support for plug-ins written in ruby |
--enable-luainterp | Turn on support for plug-ins written in lua |
--enable-perlinterp | Turn on support for plug-ins written in perl |
--enable-multibyte | Open multi-byte support, you can enter Chinese in Vim |
--enable-cscope | Open support for the cscope, cscope is a good code browsing tool |
--with-python-config-dir=/usr/lib/python2./config*/ | Specifies the python path |
--with-python3-config-dir=/usr/lib/python3./config*/ | Python3 specified path |
--prefix=/usr/local/vim | Specifies the path to be mounted to the (re default installation / usr / local / bin / vim) |
--enable-fontset | Support font settings |
--enable-gui=gtk2 | gtk2 support, you can also use gnome, representation generation gvim |
--with-compiledby | Compiled by |
Add to the environment variables
This installation of the system can not automatically find vim, we need to tell the system where it is, we need to add environment variables.
Here python3-config-dir need to specify your own directory for /usr/lib*/python3.*/config*.
If you are using bash, modify ~/.bashrc
, add the line:
export PATH=$PATH:/usr/local/vim/bin