Vim: The Power User’s Editor

Vim has a reputation for being unusable. The reputation is half-deserved: the first hour is genuinely confusing, because vim works on a different model than every other editor. After the first hour, vim feels obvious — and after a week, you edit faster than anyone using a mouse.

The mental model: modes

Vim is modal. Different keys do different things depending on which mode you’re in. The two modes that matter:

  • Normal mode (default) — keys are commands. j moves down. dd deletes a line. /word searches.
  • Insert mode — keys type characters. Press i from normal mode to enter; press Esc to leave.

You spend most of your time in normal mode, treating editing as a series of commands. This sounds backwards. After a week, every other editor feels slow.

The 25 commands you actually need

# OPENING
vim file.txt           open or create

# MODES (start in normal mode by default)
i        enter insert mode (start typing)
a        enter insert mode AFTER cursor
o        open new line below and enter insert mode
Esc      back to normal mode

# SAVE / QUIT (from normal mode)
:w       write (save)
:q       quit
:wq      save and quit
:q!      quit WITHOUT saving (discard changes)
ZZ       same as :wq

# MOVE (in normal mode)
h j k l  left, down, up, right
w / b    next / previous word
0 / $    start / end of line
gg / G   top / bottom of file
:42      jump to line 42

# EDIT (in normal mode)
dd       delete line (also yanks to register)
yy       yank (copy) line
p        paste after cursor
u        undo
Ctrl+r   redo
x        delete one character
r{c}     replace one character with {c}

# SEARCH
/text    search forward
?text    search backward
n / N    next / previous match
:s/old/new/g     replace on current line
:%s/old/new/g    replace in whole file

Survive your first vim session

You opened a file. You typed something. Now you don’t know how to save or exit. Press Esc, then type :wq, then Enter. To exit without saving: Esc, :q!, Enter.

The grammar that makes vim worth it

Vim commands compose. You can prefix actions with counts, and combine actions with motions:

5dd      delete 5 lines
3w       move 3 words forward
d3w      delete 3 words
dt;      delete forward until ;
ci"      change everything inside the next "..."
yy3p     copy line, paste 3 times

Once ci" is muscle memory, you’ll use it 100 times a day.

A starter .vimrc

Drop this in ~/.vimrc:

" basic sanity
syntax on
set number
set relativenumber
set tabstop=4 shiftwidth=4 expandtab
set ignorecase smartcase
set incsearch hlsearch
set mouse=a
set clipboard=unnamedplus
set undofile
filetype plugin indent on

Practice tools

  • vimtutor — built-in 30-minute interactive tutorial. Just run vimtutor in any terminal.
  • Vim Adventures — a game that teaches motions.
  • OpenVim — interactive in-browser tutorial.

What to learn next

Once vim is comfortable, the next big lever is the shell itself: PATH, environment variables, pipes, and redirects. The shell + vim combo is what makes the command line a real productivity environment.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *