Vim Cheatsheet - Editor Command Reference

Essential Vim commands for editing configs on a server. Organized by motion, edit, search, visual mode, and save/exit — just copy and use when stuck.

SysOps·21 commands·Last updated 2026-07-21
Back to SysOps

Motion 5

gg / G
Jump to top / bottom of file
0 / $
Jump to start / end of line
w / b
Forward / backward one word
:42
Jump to line 42
Ctrl-f / Ctrl-b
Page down / page up

Edit 6

i / a
Enter insert mode before / after cursor
o / O
New line below / above and enter insert mode
dd / yy
Delete / yank (copy) current line
p / P
Paste after / before cursor
u / Ctrl-r
Undo / redo
x / r<char>
Delete character / replace single character

Visual Mode & Save/Exit 6

v / V
Character-wise / line-wise visual selection
Ctrl-v
Block visual mode for column editing
:w
Save
:wq or ZZ
Save and quit
:q!
Force quit without saving
:w !sudo tee %
Force save when forgot sudo

💡 Tips

  • Stuck in Vim? Press Esc to return to Normal mode, then type :q! to force quit without saving.
  • Forgot sudo when editing a system file? Use :w !sudo tee % to save with elevated privileges without reopening.
  • Before a large substitution, use /word to confirm matches, then :%s — add the c flag to confirm each replacement.

Official References

Commands are compiled from the official docs below. Click to verify the latest usage.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Found an error? Report it

Wrong command or description? Open an issue to help us fix it.

Found an error? Report it