DD
DevDash

Last updated: April 12, 2026

Vim Commands Cheatsheet

Quick Answer

Vim has two main modes: Normal (for navigation/commands) and Insert (for typing). Press i to enter Insert mode, Esc to return to Normal mode. :w saves, :q quits, :wq saves and quits. This cheatsheet covers 25 essential commands.

Mode Switching

CommandDescription
i

Enter Insert mode before cursor

a

Enter Insert mode after cursor

o

Open new line below and enter Insert mode

O

Open new line above and enter Insert mode

Esc

Return to Normal mode from any mode

v

Enter Visual mode (character selection)

V

Enter Visual Line mode (line selection)

Navigation

CommandDescription
h, j, k, l

Move left, down, up, right

w

Move forward one word

b

Move backward one word

gg

Go to first line of file

G

Go to last line of file

0 / $

Move to start / end of line

Editing

CommandDescription
dd

Delete (cut) current line

yy

Yank (copy) current line

p

Paste after cursor

P

Paste before cursor

x

Delete character under cursor

u

Undo last change

Ctrl+r

Redo (undo the undo)

Search

CommandDescription
/<pattern>

Search forward for pattern

/function searches for "function"
n / N

Go to next / previous search match

:%s/old/new/g

Replace all occurrences in the file

:%s/foo/bar/g replaces all "foo" with "bar"

File Operations

CommandDescription
:w

Save (write) the file

:q / :q!

Quit / force quit without saving

Frequently Asked Questions

More Cheatsheets

Want API access + no ads? Pro coming soon.