Vim Essentials

Version: 9.xPublished: 2026-01-16vim/core

Essential Vim commands for text editing.

Modes

ExampleDescription
Esc
Normal mode
Return to normal mode from any other mode.
i
Insert mode
Enter insert mode before cursor.
a
Append
Enter insert mode after cursor.
v
Visual mode
Start character-wise visual selection.
V
Visual line
Start line-wise visual selection.
:
Command mode
Enter command-line mode.

Navigation

ExampleDescription
h j k l
Move by character
Left, down, up, right.
w
Move by word
Jump to start of next word.
b
Move by word back
Jump to start of previous word.
0
Line start
Jump to beginning of line.
$
Line end
Jump to end of line.
gg
File start
Jump to first line of file.
G
File end
Jump to last line of file.
42G
Go to line
Jump to line 42.

Editing

ExampleDescription
x
Delete character
Delete character under cursor.
dw
Delete word
Delete from cursor to start of next word.
dd
Delete line
Delete entire current line.
cw
Change word
Delete word and enter insert mode.
cc
Change line
Delete line and enter insert mode.
r
Replace character
Replace single character under cursor.
u
Undo
Undo last change.
Ctrl+r
Redo
Redo last undone change.

Copy & Paste

ExampleDescription
yy
Yank line
Copy current line.
yw
Yank word
Copy from cursor to start of next word.
p
Paste after
Paste after cursor.
P
Paste before
Paste before cursor.

Search

ExampleDescription
/pattern
Search forward
Search for pattern forward.
?pattern
Search backward
Search for pattern backward.
n
Next match
Jump to next search match.
N
Previous match
Jump to previous search match.
:%s/old/new/g
Search and replace
Replace all occurrences in file.

Files

ExampleDescription
:w
Save
Write current file to disk.
:q
Quit
Quit (fails if unsaved changes).
:wq
Save and quit
Write and quit.
:q!
Force quit
Quit without saving changes.
:e filename
Open file
Open another file for editing.