17 Vim shortcuts that won’t hurt learning πŸ˜‰

Pawan Acharya
codingmountain
Published in
3 min readAug 25, 2022

git add .
git commit
<enter>

BOOMMMMM…..

Some random black screen, where you can’t write nor exit🀨

Did this remind you of something ?πŸ˜‰

Well, you are not alone here, most developers have passed through this phase. And that pro feeling when you are finally able to crack how to exit VIM 😎.

Okay Okay, enough of VIM jokes 🀫

With plenty of Shortcuts/Motions of VIM, it can probably save a few seconds of your life, and make you cool among friends.😎

So with that motivation πŸ˜‰ let's dive into some VIM motions.

Note: Don’t learn these at one go, try one of the shortcuts daily in your work and increase your count so as not to feel overwhelmed.

A. Basic Navigation (j,k,h,l)

1. Down: j
2. Up: k
3. Left: h
4. Right: l

B. Navigate Word by Word:

5. w

C. Reach the Top or Bottom of the file

6. Top: gg
7. Bottom: G <-- Uppercase G (Shift + G)

D. Insert ( i, a, o )

8.  To insert left of the cursor: i
9. To insert left of the line: I
10. To insert right of the cursor: a
11. To insert right of the current line: A <--- I love this πŸ’™
12. To insert at the start of the new line: o <--- I love this more πŸ’™πŸ’™

E. Undo the changes

13. u

F. Delete the whole line

14.    dd
Bonus: 5dd <-- to delete 5lines below

G. Delete single word

15. dw

H. Copy Paste line

16. yy pyy <-- copy (yank) current line
p <-- paste to the line below cursor
P <-- paste to the line above cursor

H. Select Line

17. Shift + V-> It will select the current lineBonus: Navigate to other lines using j,k, and press d to delete or y to copy, etc.

Congratulations on making yourself here πŸ‘ πŸ‘
Just follow one shortcut daily, don't rush yourself, take your time and eventually, you will get the hang of it.

I hope you learned something new today.

I will be back with more such content. πŸ‘‹πŸ‘‹πŸ‘‹

Wait a minute

Let’s exit this article in the VIM way

:q! <--- exit vim and discard the change
:wq <--- exit vim and write the change

That's the end of the article.
Remember to reiterate.
πŸ‘‹πŸ‘‹πŸ‘‹

--

--