docs/vim8.md

1.8 KiB

Vim

This document describes my personal preference for Vim 8 setup.

Compile Vim 8 from source and install in home directory

# install required dependencies
sudo apt install libncurses5-dev python3-dev git

# clone vim from github repositories
git clone https://github.com/vim/vim.git

# build vim 8
cd vim
./configure --with-features=huge --enable-multibyte --enable-python3interp=yes --prefix=$HOME/.local
make
make install

# add $HOME/.local bin to PATH to prioritize Vim8
echo "export PATH=\$HOME/.local/bin:\$PATH" >> $HOME/.bashrc

Setup plugins using vundle

# clone from github repositories
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

# create .vimrc configuration file in home
cd $HOME
cat << EOF > .vimrc
set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Shougo/Denite.nvim'
Plugin 'Valloric/YouCompleteMe'

call vundle#end()
filetype plugin indent on

set backspace=indent,eol,start
set tabstop=4 shiftwidth=4 expandtab
set number numberwidth=4
set splitbelow
set encoding=utf-8 fileencoding=utf-8
syntax on
EOF

# install plugins
vim +PluginInstall +qall

Additional config for auto-completion using YouCompleteMe

# install compile dependencies
sudo apt install build-essential cmake python-dev

# clone from github repositories and install python, go, and javascript completion
cd $HOME/.vim/bundle/YouCompleteMe
./install.py --go-completer --js-completer

# for javascript autocompletion
cd $HOME/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime
npm install --production
cat << EOF > $HOME/.tern-config
{
    "libs" : [
        "browser"
    ]
    "plugins": {
        "node": {}
    }
}
EOF