Setup and install Vim8 for deoplete.nvim

October 9, 2018

I wanted to use deoplete.nvim, so I need to meet requirements for it.

I tried it on Amazon Linux.

install git to get pyenv and source code of vim

$ sudo yum install -y git

install pyenv and modify shell configuration

$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

install python2 and 3 by pyenv

$ sudo yum install -y readline-devel bzip2-devel openssl-devel sqlite-devel patch gcc
$ CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.6
$ CONFIGURE_OPTS="--enable-shared" pyenv install 2.7.9
$ pyenv global 2.7.9 3.6.6
$ pyenv rehash

To share Python libraries dynamically for Vim, “–enable-shared” option is needed.

install neovim and greenlet

$ pip3 install neovim
$ pip3 uninstall -y greenlet
$ pip3 install greenlet --no-binary :all:

Greenlet seems to have problem when normaly installed by pip3. It need to be re-installed with --no-binary :all: option.

install vim from source code

$ mkdir -p ~/local/src
$ git clone --depth 1 https://github.com/vim/vim ~/local/src/vim
$ cd ~/local/src/vim/src
$ LDFLAGS="-Wl,-rpath=${HOME}/.pyenv/versions/2.7.9/lib:${HOME}/.pyenv/versions/3.6.6/lib"   ./configure --prefix=$HOME/local/vim --enable-luainterp=yes --enable-python3interp=yes --enable-pythoninterp=yes --enable-gui=no --enable-multibyte
$ make
$ make install
$ echo 'export PATH="$HOME/local/vim/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
$ vim --version

To link with python libraries, vim need to be compiled with LDFLAGS option.