Fundamentals 8 min read

Vim Mastery: Complete Visual Guide to Essential Commands and Keybindings

This comprehensive illustrated reference covers Vim's core keybindings across progressive learning levels — from basic navigation and editing to advanced visual mode operations — with practical examples for character, word, line, and screen movement, text insertion, editing, search, and file management.

Linux Tech Enthusiast
Linux Tech Enthusiast
Linux Tech Enthusiast
Vim Mastery: Complete Visual Guide to Essential Commands and Keybindings

Classic Vim Cheat Sheets

The article opens with classic Vim cheat sheet images in both English and Simplified Chinese versions, serving as comprehensive reference posters that combine multiple beginner tutorial diagrams into single views.

Progressive Learning Levels

Recognizing that mastery requires gradual progression, the guide organizes content into four tiers:

Beginner (入门版) — Basic operations cheat sheet for absolute newcomers.

Intermediate (进阶版) — Expanded command set for regular editing tasks.

Enhanced (增强版) — Modern, information-rich version with additional shortcuts.

Text Version (文字版) — Plain-text command reference for quick lookup.

Core Command Categories

Movement by Character, Word, and Token

h – move cursor left
j – move cursor down
k – move cursor up
l – move cursor right

Prefix with a number to repeat (e.g., 5j moves down five lines). Word/token navigation distinguishes between words (separated by non-alphanumerics) and tokens (separated by whitespace):

b – beginning of word
B – beginning of token
w – beginning of next word
W – beginning of next token
e – end of word
E – end of token

Example: on the phrase step-by-step, b moves to the s of step (after the hyphen), while B jumps to the very first s because hyphens are not whitespace.

Line Movement

0 – jump to line start
$ – jump to line end
^ – jump to first non-blank character
#G / #gg / :# – go to line number #

Screen Movement (without scrolling)

Ctrl+b – page up
Ctrl+f – page down
Ctrl+d – half page down
Ctrl+u – half page up
Ctrl+e – scroll down one line (cursor stationary)
Ctrl+y – scroll up one line (cursor stationary)
Ctrl+o – jump back in jump list
Ctrl+i – jump forward in jump list
H – top of screen (High)
M – middle of screen (Middle)
L – bottom of screen (Low)

Insert Mode Entry Points

i  – insert before cursor
I  – insert at line start
a  – insert after cursor
A  – insert at line end
o  – open new line below
O  – open new line above
ea – insert at word end
Esc – return to command mode
:  – enter command-line mode

Vim starts in command mode; press i to enter insert mode, Esc to return.

Text Editing

r       – replace single character (returns to command mode)
cc      – replace entire line (deletes line, enters insert mode)
C / c$  – replace from cursor to line end
cw      – replace from cursor to word end
s       – delete character and enter insert mode
J       – join next line with a space
gJ      – join next line without space
u       – undo
Ctrl+r  – redo
.       – repeat last change

Cut, Copy, Paste

yy      – yank (copy) current line
#yy     – yank # lines
dd      – delete (cut) current line
#dd     – delete # lines
p       – paste after cursor
P       – paste before cursor

Search in File

*       – next occurrence of word under cursor
#       – previous occurrence of word under cursor
/pattern – forward search for pattern
?pattern – backward search for pattern
n       – repeat search in same direction
N       – repeat search in opposite direction

Save and Exit

:w           – save, keep open
:wq          – save and quit
:q           – quit (fails if unsaved changes)
:q!          – quit without saving
Shift+zz     – save and quit
:w new_name  – save as new_name, continue editing original
:sav new_name – save as new_name, switch to new copy
:w! sudo tee% – write with sudo via tee

Visual Mode (Text Selection)

Three selection granularities:

v        – character-wise
V        – line-wise
Ctrl+v   – block-wise

After entering a visual mode, use navigation keys to extend selection. Additional selection shortcuts:

o        – swap selection ends
aw       – select a word
ab       – select block with ()
aB       – select block with {}
at       – select block with <>
ib       – select inside ()
iB       – select inside {}
it       – select inside <>

Visual Mode Commands

Once text is selected:

y – yank (copy) selection
d – delete (cut) selection
p – paste after cursor
u – lowercase selection
U – uppercase selection
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxproductivitytext editorVimdeveloper toolsterminalcommand referencekeybindings
Linux Tech Enthusiast
Written by

Linux Tech Enthusiast

Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.