Ubuntu Desktop 18 + Vi – Add Color Schemes (Molokai)

This is just a simple reminder for myself.  To get VIM working with custom color schemes on Ubuntu Desktop, you need to install a couple extra packages.

Here are the steps to install the molokai theme from GitHub properly:

sudo apt-get update
sudo apt-get install vim-gui-common -y
sudo apt-get install vim-runtime -y
mkdir -p ~/.vim/colors
cd ~/.vim/colors
wget https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim

And to enable it as default, you have to edit your “~/.vimrc” file to say the following color scheme line. I also left in a couple lines that help arrow keys and backspace to work normally for the heck of it.

set nocompatible
set backspace=2
colorscheme molokai

My VI Cheat Sheet

For years, I’ve been somewhat avoiding learning any advanced features of VIM. I have always predominantly relied on desktop editors for anything complex and just use VI to do basic text modification.

Anyway, I’m finally trying to change that. So, I’ll start forcing myself to do things in VIM and will record the keys here over time. I’m just starting with one command though; so it’ll be a while before this is useful! 🙂

My Cheat Sheet

Remember, generally you want to press “esc” before doing these.

  • Search Forward & Backwards
    • Forward = /search-term
    • Backward = ?search-term
  • Show or Hide Line Numbers
    • : set number
    • :set nonumber
  • Edit Multiple Lines (e.g. Block Comment Lines 10-20 With #)
    • :10,20s/^/#/
  • Clear Highlight After Search
    • There are some fancy ways, but just search for something that won’t exist and it will clear.  For example:
      • /blahfwoeaf