vim Command Cheat Sheet
vim is a powerful terminal-based text editor.
Launch and Exit
vim filename.txt # Open file
:q # Quit
:q! # Quit without saving
:w # Save
:wq or ZZ # Save and quit
Insert Mode
i→ Insert at cursorI→ Insert at line starta→ Append after cursorA→ Append at line end
Navigation
hjkl→ Left, down, up, right0,^,$→ Line start, first non-space, endgg,G→ Top, bottom:n→ Go to line n
Editing
dd→ Delete lineyy→ Yank linep→ Pasteu→ UndoCtrl+r→ Redo
Search
/pattern # Search forward
?pattern # Search backward
n/N # Next/previous match