Essential Vim command
i → Enter insert mode before the cursor.
I → Enter insert mode at the beginning of the line.
a → Enter insert mode after the cursor.
A → Enter insert mode at the end of the line.
o → Open a new line below the current line.
O → Open a new line above the current line.
yy → Copy (yank) the current line.
dd → Delete the current line.
D → Delete from the cursor position to the end of the line.
x → Delete the character under the cursor.
p → Paste the content after the cursor.
P → Paste the content before the cursor.
u → Undo the last change.
Ctrl + r → Redo the last undone change.
:w → Save the current file.
:q → Quit Vim (close current file).
:q! → Quit Vim without saving changes.
:wq → Save and quit.
:e <filename> → Open a new file.
:bnext (:bn) → Switch to the next buffer.
:bprev (:bp) → Switch to the previous buffer.
:bd → Close the current buffer.
:vsp <filename> → Open a file in a vertical split.
:sp <filename> → Open a file in a horizontal split.
Ctrl + w + hjkl → Move between split windows.
gg → Move to the beginning of the file.
G → Move to the end of the file.
:set number → Show line numbers.
:set nonumber → Hide line numbers.
/pattern → Search forward for the specified pattern.
?pattern → Search backward for the specified pattern.
n → Move to the next search result.
N → Move to the previous search result.
* or # → Search for the word under the cursor (forward/backward).
:s/pattern/replace/g → Replace all occurrences of a pattern.
:s/pattern/replace/gc → Replace with confirmation.
:%s/foo/bar/g → Replace all occurrences in the entire file.
Ctrl + ] → Jump to the definition of a function (using tags).
Ctrl + t → Jump back from the definition.
:r <filename> → Read the content of a file and insert it.
:set ts=4 → Set tab stop to 4 spaces.
:set expandtab → Use spaces instead of tabs.
:set nowrap → Disable line wrapping.
:set wrap → Enable line wrapping.