Est. 1991 — The Editor of Champions

Master the Art of Vim

A comprehensive reference for the world's most powerful text editor. From first steps to advanced wizardry.

I.

Getting Started with Vim

Essential knowledge for beginners. These three commands will get you through your first session.

1

Enter Command Mode

Press Esc then type : to enter command mode. This is where you'll issue commands to save, quit, or search.

2

Exit Vim Gracefully

Type :q to quit, or :q! to exit without saving your changes. To save and exit, use :wq

3

Practice Makes Perfect

Vim's modal editing takes time to master, but the investment pays dividends. Start with the basics and gradually build your muscle memory.

II.

Complete Command Reference

A comprehensive catalog of Vim commands, organized by category for easy reference.

Essential

:q
Quit (close window)
:q!
Quit and throw away unsaved changes
:w
Save (write) the file, but don't exit
:wq
Save and quit
i
Switch to insert mode
Esc
Switch to command mode

Navigation

h
Move cursor left
j
Move cursor down
k
Move cursor up
l
Move cursor right
w
Jump forwards to the start of a word
b
Jump backwards to the start of a word
e
Jump forwards to the end of a word
0
Jump to the start of the line
$
Jump to the end of the line
gg
Go to the first line of the document
G
Go to the last line of the document
{
Jump to previous paragraph
}
Jump to next paragraph
Ctrl+u
Move up half a screen
Ctrl+d
Move down half a screen

Editing

x
Delete character at cursor
dw
Delete word
dd
Delete line
D
Delete from cursor to end of line
yy
Yank (copy) a line
yw
Yank (copy) word
p
Paste after cursor
P
Paste before cursor
u
Undo
Ctrl + r
Redo
r
Replace a single character
cw
Change (replace) to the end of the word
cc
Change (replace) entire line
c$
Change (replace) to the end of the line
~
Switch case of the character under the cursor

Searching

/pattern
Search forward for pattern
?pattern
Search backward for pattern
n
Repeat search in same direction
N
Repeat search in opposite direction
*
Search forward for word under cursor
#
Search backward for word under cursor
:%s/old/new/g
Replace all old with new throughout file
:%s/old/new/gc
Replace all old with new throughout file with confirmations

Visual Mode

v
Start visual mode, mark lines, then do a command (like y-yank)
V
Start linewise visual mode
Ctrl+v
Start visual block mode
o
Move to other end of marked area
O
Move to other corner of block
aw
Mark a word
ab
A block with ()
aB
A block with {}
ib
Inner block with ()
iB
Inner block with {}

File Operations

:e filename
Edit a file in a new buffer
:bnext
Go to the next buffer
:bprev
Go to the previous buffer
:bd
Delete a buffer (close a file)
:sp filename
Open a file in a new buffer and split window
:vsp filename
Open a file in a new buffer and vertically split window
Ctrl+ws
Split window
Ctrl+ww
Switch windows
Ctrl+wq
Quit a window
Ctrl+wv
Split window vertically

About VimLeap

VimLeap is a carefully crafted reference guide for Vim, the legendary text editor. Born from the Unix tradition and refined over decades, Vim remains the tool of choice for developers, writers, and system administrators worldwide.

This guide aims to make Vim's powerful features accessible to everyone—from curious beginners to seasoned practitioners.

Questions or suggestions? Write to emah84@gmail.com