How to set TAB to 2 spaces in vim

Problem

You would like to set up your vim editor to use 2 spaces for the tab character.

Solution

Add the following to your ~/.vimrc file:

set ts=2