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:
- Normal Mode: For navigation and manipulation.
- Insert Mode: For typing text.
- Visual Mode: For selecting text.
- Command Mode: For saving, exiting, etc.
Essential Shortcuts
Here is a cheat sheet to get you started.
| Key | Action |
|---|---|
h j k l | Left, Down, Up, Right |
w | Jump forward to the start of a word |
b | Jump backward to the start of a word |
i | Insert before the cursor |
a | Append after the cursor |
:w | Save |
:q | Quit |
:wq | Save 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!