/void !

Vim

2 min read


⚙️ Modes🔗

ModeDescriptionHow to enter
NormalDefault mode (navigate, edit commands)Press Esc
InsertType and insert texti, I, a, or A
VisualSelect textv (character), V (line), Ctrl+v (block)
Command-lineRun commands (save, quit, etc.): from Normal mode

CommandAction
h / j / k / lMove left / down / up / right
0Beginning of line
$End of line
w / bNext / previous word
ggGo to start of file
GGo to end of file
:nGo to line n (e.g., :42)
Ctrl+d / Ctrl+uScroll half page down / up
Ctrl+f / Ctrl+bScroll full page down / up

✏️ Insert Mode🔗

CommandAction
iInsert before cursor
IInsert at beginning of line
aAppend after cursor
AAppend at end of line
oOpen new line below
OOpen new line above
EscReturn to Normal mode

� Editing🔗

CommandAction
xDelete character under cursor
ddDelete current line
DDelete to end of line
dwDelete word
uUndo
Ctrl+rRedo
yyYank (copy) current line
pPaste below
PPaste above
r<char>Replace single character
cwChange word (delete + insert)
ccChange entire line
JJoin current and next line

� Search & Replace🔗

CommandAction
/patternSearch forward
?patternSearch backward
n / NNext / previous match
:%s/old/new/gReplace all in file
:s/old/new/gReplace all in current line
:%s/old/new/gcReplace all (confirm each)

� Files & Saving🔗

CommandAction
:wSave file
:qQuit
:wq or :xSave and quit
:q!Quit without saving
:e filenameOpen file
:saveas newfileSave as new file
:lsList open buffers
:bn / :bpNext / previous buffer

⚡ Useful Tricks🔗

CommandAction
.Repeat last command
>> / <<Indent / unindent line
=Auto-indent selection
Ctrl+gShow file info
%Jump to matching bracket/parenthesis
:help <command>Open Vim help for a command

� Example Workflow🔗

  1. Open file → vim myfile.txt
  2. Move to a line → gg or /word
  3. Edit → i (insert mode), then Esc
  4. Save → :w
  5. Quit → :q

✅ Tip: You can combine counts with commands —
For example, 3dd deletes 3 lines, 5w moves forward 5 words.