Setting up Vim

Share on:

"Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X."

This tutorial covers the steps required to setup Vim (including Python 3.x support).

Installation Guide

There are lots of really excellent tutorials on setting up Vim for the first time. Personally I dont use most of the features, so have been steadily reducing the number of plugins I use.

I do (currently) use YouCompleteMe, so I have included that.

  • Install ~/.vimrc
  • curl vim-plug to install
  • Install vim-plug gives PlugInstall in Vim
  • Install pluging (i.e. PlugInstall)
  • Finalise YouCompleteMe installation via command-line

Download and install the bash script

1curl -fLO  https://raw.githubusercontent.com/rosera/machine-config/master/vim/vimconfig.sh | bash -

vim-plug installation

vim-plug

  • Run curl command to install vim-plug
1curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
2    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Backup directory

  • Create a undodir mkdir -p ~/.vim/undodir

Install Vim plugins

  • Open Vim and enter the command:
1PlugInstall

NOTE: Ignore the errors at this stage, they are a result of the PlugIns not being installed

YouCompleteMe

Requirements:

  • Vim v8.1.2269+
  • Vim with Python3 support 3.5.1+

Annoyingly YouCompleteMe requirements may mean you have to upgrade your existing Vim installation. A brief guide on how to compile Vim is referenced below.

Earlier post on How to compile Vim with Python3.x compatibility

Installation

Install packages

1sudo apt install cmake

Move to the YouCompleteMe directory

1cd ~/.vim/plugged/YouCompleteMe

Finish the install for YouCompleteMe

1python3 install.py

Plugin

The .vimrc uses the following plugins:

General

  • Plug 'vim-airline/vim-airline'
  • Plug 'vim-airline/vim-airline-themes'
  • Plug 'ap/vim-css-color'
  • Plug 'airblade/vim-gitgutter'
  • Plug 'morhetz/gruvbox'
  • Plug 'jremmen/vim-ripgrep'
  • Plug 'tpope/vim-fugitive'
  • Plug 'vim-utils/vim-man'
  • Plug 'preservim/nerdtree'
  • Plug 'Valloric/YouCompleteMe'
  • Plug 'mbbill/undotree'

Development

  • Plug 'tpope/vim-markdown'
  • Plug 'junegunn/goyo.vim'
  • Plug 'leafgarland/typescript-vim'
  • Plugin 'vim-ruby/vim-ruby'
  • Plugin 'tpope/vim-rails'
  • Plugin 'fatih/vim-go'
  • Plugin 'pangloss/vim-javascript'

The result is shown in the image below:

The vim interface should look similar to image displayed below: vim interface