1. Prepare your environment.
$ sudo apt install libncurses5-dev \
        libgtk2.0-dev libatk1.0-dev \
        libcairo2-dev python-dev \
        python3-dev git

2. Remove Old VIM.
$ sudo apt remove vim vim-runtime gvim

3. Install VIM.
$ cd /usr && sudo git clone https://github.com/vim/vim.git && cd vim  

$ sudo ./configure --with-features=huge \
        --enable-multibyte \
        --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-gui=gtk2 \
        --enable-cscope \
        --prefix=/usr/local/

$ sudo make VIMRUNTIMEDIR=/usr/local/share/vim/vim81 

4. Preparing deb package using "checkinstall"
$ sudo apt install checkinstall
$ cd /usr/vim && sudo checkinstall

5. Set VIM as a default editor
$ sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
$ sudo update-alternatives --set editor /usr/local/bin/vim
$ sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
$ sudo update-alternatives --set vi /usr/local/bin/vim

6. Verify that you're running the new Vim binary by looking
$ vim --version | grep python

 

Reference: https://vi.stackexchange.com/questions/11526/how-to-enable-python-feature-in-vim

dreamtails 發表在 痞客邦 留言(0) 人氣()