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
P

My name is 𝐏𝐫𝐚𝐀𝐚𝐬𝐑 and I talk about 𝗧𝗲𝗰𝗡-𝐊𝐧𝐨𝐰π₯𝐞𝐝𝐠𝐞, π—ͺπ—²π—―π——π—²π˜ƒ, π——π—²π˜ƒπ—’π—½π˜€ and π—Ÿπ—Άπ—³π—²π˜€π˜π˜†π—Ήπ—².


πŸ”Ή 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

More from this blog

Learn with Prakash

36 posts

My name is 𝐏𝐫𝐚𝐀𝐚𝐬𝐑 and I talk about 𝗧𝗲𝗰𝗡-𝐊𝐧𝐨𝐰π₯𝐞𝐝𝐠𝐞, π—ͺπ—²π—―π——π—²π˜ƒ, π——π—²π˜ƒπ—’π—½π˜€ and π—Ÿπ—Άπ—³π—²π˜€π˜π˜†π—Ήπ—².