I tend to forget about various Linux commands especially when working in vim. This is why I decide to create this Vim Cheatsheet and share it with the world. Remember, Vim = Vi Improved (vi + extra features like syntax highlighting, undo/redo, plugins, scripting).
In order to get inspiration I first had to brew a great cup of Latin America specialty coffee using my moka pot at home. Let’s get started!
Modes in Vim
- Normal mode → navigation & commands (default)
- Insert mode → editing text (
i,a,o) - Visual mode → select text (
v,V) - Command mode → type commands (
:)
Basic File Operations
:w " Save file
:q " Quit
:q! " Quit without saving
:wq " Save and quit
:x " Save and quit (same as :wq)
:saveas newfile.txt " Save file with new nameNavigation
h " Left
l " Right
j " Down
k " Up
Ctrl + d " Half-page down
Ctrl + u " Half-page up
gg " Go to beginning of file
G " Go to end of file
:n " Jump to line n (example: :42)Insert & Edit
i " Insert before cursor
a " Append after cursor
o " Open new line below
O " Open new line above
r " Replace single character
R " Replace until Esc
u " Undo last change
Ctrl + r " RedoDelete, Copy, Paste
x " Delete character
dd " Delete line
5dd " Delete 5 lines
yy " Yank (copy) line
5yy " Yank 5 lines
p " Paste below
P " Paste aboveSearch & Replace
/word " Search forward
?word " Search backward
n " Next match
N " Previous match
:%s/foo/bar/g " Replace all 'foo' with 'bar'
:10,20s/foo/bar/g " Replace between lines 10 and 20Visual Mode
v " Select characters
V " Select whole lines
Ctrl + v " Block selection (columns)
y " Yank (copy) selection
d " Delete selection
p " Paste after cursorMultiple Files & Buffers
:e file.txt " Open file
:bn " Next buffer
:bp " Previous buffer
:ls " List buffers
:b 2 " Switch to buffer 2Splits & Tabs
:split file.txt " Horizontal split
:vsplit file.txt " Vertical split
Ctrl + w + w " Switch between splits
:tabnew file.txt " Open in new tab
:tabn " Next tab
:tabp " Previous tabMain Differences Between vi and vim
vi → the original, very minimal editor (1976).vim → “Vi IMproved” with extra features.
| Feature | vi | vim |
|---|---|---|
| Syntax highlighting | ❌ No | ✅ Yes |
| Undo/Redo | ❌ Limited | ✅ Multiple levels |
| Plugins | ❌ No | ✅ Yes |
| Split windows | ❌ No | ✅ Yes |
| Visual selection | ❌ No | ✅ Yes |
| Command-line completion | ❌ No | ✅ Yes |
| Available today | ✅ Minimal, always present | ✅ Default on modern Linux |
I hope this Vim Cheatsheet helps somebody out there. If you like to support me consider ordering one of my T-Shirts and/or coffee mug designs from my shop here.

