Skip to main content

Command Palette

Search for a command to run...

Vim Cheatsheet for Beginners

Learn Some Basic Vim Commands

Updated
β€’2 min read
Vim Cheatsheet for Beginners

πŸ”Ή Modes

  • Normal mode β†’ (default) for commands & navigation

  • Insert mode β†’ type text (i, a, o)

  • Visual mode β†’ select text (v, V)

  • Command mode β†’ type : for commands


πŸ”Ή File & Exit

ActionCommand
Save:w
Quit:q
Save & quit:wq
Quit without saving:q!
Save as…:w filename

πŸ”Ή Insert Text

ActionCommand
Insert before cursori
Insert after cursora
New line belowo
New line aboveO
Append at end of lineA

πŸ”Ή Navigation

ActionCommand
Left / Down / Up / Righth j k l
Start of line0
End of line$
Next wordw
Previous wordb
End of worde
Go to line N:N
First linegg
Last lineG
Half page down / upCtrl-d / Ctrl-u

πŸ”Ή Editing

ActionCommand
Delete characterx
Delete worddw
Delete to end of lineD
Delete linedd
Copy (yank) lineyy
Pastep
Change word (delete + insert)cw
Replace single characterr<char>
Undou
RedoCtrl-r

πŸ”Ή Visual Mode

ActionCommand
Start selectionv (char), V (line)
Copyy
Deleted
Indent>
Unindent<

πŸ”Ή Search & Replace

ActionCommand
Search forward/word then n (next), N (prev)
Search backward?word
Replace (line):s/old/new/g
Replace (file):%s/old/new/g