Vim Cheatsheet

A quick reference for essential Vim commands.

Editing (Normal Mode)

Command Description
x Delete the character under the cursor.
dd Delete the current line.
yy Yank (copy) the current line.
p Paste the copied/deleted text after the cursor.
u Undo the last change.
Ctrl + r Redo the last change.

Essential Commands

Command Description
i Enter Insert mode.
Esc Exit Insert mode and return to Normal mode.
:w Write (save) the file.
:q Quit.
:q! Quit without saving changes.
:wq Write and quit.

Navigation (Normal Mode)

Command Description
h Move left.
j Move down.
k Move up.
l Move right.
w Move to the start of the next word.
b Move to the start of the previous word.
gg Go to the first line of the file.
G Go to the last line of the file.

Search and Replace

Command Description
/pattern Search forward for 'pattern'.
?pattern Search backward for 'pattern'.
n Repeat the search in the same direction.
N Repeat the search in the opposite direction.
:%s/old/new/g Replace all occurrences of 'old' with 'new' in the entire file.
:%s/old/new/gc Replace with confirmation for each occurrence.

© 2025 devcortex.ai ・ AI-powered developer tools.