vim Essentials
You can exit vim now. Let's make you productive in it.
All commands here work in Normal mode. Press Esc first if unsure.
Navigation
Basic Movement
Arrow keys work too, but hjkl keeps hands on home row.
Word Movement
Line Movement
File Movement
Combine Numbers with Movement
5j moves down 5 lines. 3w moves forward 3 words. Numbers multiply commands.
Entering Insert Mode
Multiple ways to start typing:
Most used: i (insert), A (append to line), o (new line below).
Deleting Text
In Normal mode:
Delete Multiple
Copy and Paste
vim calls copy "yank":
Delete = Cut
Everything you delete with d is actually cut - you can paste it with p.
Undo and Redo
Search
Example:
Search and Replace
How do you delete an entire line in vim?
Common Workflows
Quick Edit
vim file.txt → Open
/search → Find text
i → Insert mode
(make edits)
Esc → Normal mode
:wq → Save and quit
Replace All Occurrences
:%s/oldtext/newtext/g
:wq
Quick Reference
| Command | Action |
|---|---|
hjkl | Move cursor |
w/b | Word forward/back |
gg/G | Start/end of file |
i/a/o | Insert mode |
dd | Delete line |
yy | Copy line |
p | Paste |
u | Undo |
/text | Search |
:%s/a/b/g | Replace all |
Key Takeaways
hjklfor movement (or arrow keys)ito insert,Escto return to Normaldddeletes lines,yycopies linesppastes,uundoes/searches,n/Nnavigates matches:%s/old/new/greplaces throughout file
Next: more vim power - visual mode and advanced commands.