Mastering Vim: A Survival Guide

Mastering Vim

Vim is not just a text editor; it’s a way of life. Or at least, that’s what enthusiasts tell you.

The Modes

Vim has several modes. The most important are:

  1. Normal Mode: For navigation and manipulation.
  2. Insert Mode: For typing text.
  3. Visual Mode: For selecting text.
  4. Command Mode: For saving, exiting, etc.

Essential Shortcuts

Here is a cheat sheet to get you started.

KeyAction
h j k lLeft, Down, Up, Right
wJump forward to the start of a word
bJump backward to the start of a word
iInsert before the cursor
aAppend after the cursor
:wSave
:qQuit
:wqSave and Quit

Advanced Motions

“Efficiency is doing things right; effectiveness is doing the right things.” - Peter Drucker

Once you master the basics, try these:

  • ciw: Change In Word. Deletes the word under the cursor and switches to Insert mode.
  • dt": Delete To . Deletes everything until the next quote mark.
  • %: Jump between matching parenthesis/brackets.

My .vimrc

set number
set relativenumber
syntax on
set tabstop=4
set shiftwidth=4
set expandtab

Happy Vimming!