Question: I want to install a vim plugin, this plugin needs a `+python` feature, so when I open vim and type `:version` it displays `-python`. How can I make it enable?. 

Thanks.

Answer: 
Solution 1 :
============

* Install `vim-gtk` package 

```
sudo apt install vim-gtk   

```
* Set Vim as a default editor 

```
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim.gtk 1   
sudo update-alternatives --set editor /usr/bin/vim.gtk   
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim.gtk 1  
sudo update-alternatives --set vi /usr/bin/vim.gtk   
sudo update-alternatives --install /usr/bin/vi vim /usr/bin/vim.gtk 1  
sudo update-alternatives --set vim /usr/bin/vim.gtk    

```

Solution 2 :
============

Otherwise you need to compile Vim from source code(assuming you're using Debian based system) 

Prepare your system
===================

* Install 

```
sudo apt install libncurses5-dev \
libgtk2.0-dev libatk1.0-dev \
libcairo2-dev python-dev \
python3-dev git

```
* Remove Vim if you already have 

```
sudo apt remove vim vim-runtime gvim  

```

configure and make
==================

```
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/ \  # pay attention here check directory correct
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/ \  # pay attention here check directory correct
--enable-gui=gtk2 \
--enable-cscope \ 
--prefix=/usr/local/

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

```

Preparing deb package using [checkinstall](https://wiki.debian.org/CheckInstall)
================================================================================

* And install that package 

```
cd /usr/vim && sudo checkinstall

```
* Or, if want to just create a package use `--install=no` option with checkinstall

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   

```

Verify that you're running the new Vim binary by looking
========================================================

```
vim --version | grep python

```

**Reference :**  

 - [Building Vim from Source](https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source)  

 - [checkinstall](https://manpages.debian.org/stretch/checkinstall/checkinstall.8.en.html)
For those using anaconda python, some additional modifications are requited. They might want to compile vim as well, especially if you want code-completion. Here is the configure command:

Modified configure command for anaconda:
----------------------------------------

```
 ./configure --enable-terminal --enable-gui=auto \
      --with-features=huge \
      --enable-multibyte \
       --enable-cscope --enable-terminal --enable-gui=auto  \
      --prefix=/XXX/SOFTWARE/VIM8/install3 \
   --enable-python3interp \
   --with-python3-config-dir=/XXX/anaconda2/envs/py36/bin/python3.6-config \
   --includedir=/XXX/anaconda2/envs/py36/include  \
   --includedir=/XXX/anaconda2/envs/py36/include/python3.6m \
   LDFLAGS=" -L/XXX/anaconda2/envs/py36/lib -L/XXX/anaconda2/envs/py36/lib/python3.6/config-3.6m-x86_64-linux-gnu"

```

Here, vim is being installed to `/XXX/SOFTWARE/VIM8/install3` using anaconda environment for python 3.6 installed in `/XXX/anaconda2/envs/py36`