Vim Cheatsheet for Beginners

Perfect ๐Ÿ‘ A one-page Vim cheatsheet will help you build muscle memory fast. Hereโ€™s a clean, compact version you can keep open while practicing:


๐ŸŸข Vim Cheatsheet


๐Ÿ”น 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

โšก Memory tricks:

  • :w = write, :q = quit, ! = force

  • d = delete, y = yank (copy), p = paste

  • Motions: w (word), $ (end), 0 (start), e (end of word)


โœ… Thatโ€™s all you need to survive and thrive in Vim.


0
Subscribe to my newsletter

Read articles from UR Prakash Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

UR Prakash Gupta
UR Prakash Gupta

My name is ๐”๐‘ ๐๐ซ๐š๐ค๐š๐ฌ๐ก ๐†๐ฎ๐ฉ๐ญ๐š and I talk about ๐—ง๐—ฒ๐—ฐ๐—ต-๐Š๐ง๐จ๐ฐ๐ฅ๐ž๐๐ ๐ž, ๐—ช๐—ฒ๐—ฏ๐——๐—ฒ๐˜ƒ, ๐——๐—ฒ๐˜ƒ๐—ข๐—ฝ๐˜€ and ๐—Ÿ๐—ถ๐—ณ๐—ฒ๐˜€๐˜๐˜†๐—น๐—ฒ.