Luan Phung
Published on

Why Vim?

Authors
  • avatar
    Name
    Luan Phung
    Twitter

The story

i have been using Vim for over 6 months, and it helps me a lot.

I vividly recall my initial struggles during the first week of learning Vim. Each movement or action in Vim required a pause of about 1-2 seconds as I deliberated my next move.

However, I have since gained confidence in navigating and executing commands in Vim. Now, I effortlessly perform various actions without needing to contemplate my actions. It has become second nature to me.

How i learned

I learned vim as a language, not a complicated syntax that's hard to remember, let me explain to you how.

Step 1 First i learn the basic movement first, here is some basic movement we should remember:

  • h,j,k,l - left, down, up, right
  • w,W - to start of next word or WORD
  • b,B - to start of previous word or WORD
  • e,E - to end of word or WORD
  • $ - to end of line
  • ^ - to start of line ...

Step 2 Learn some verbs (actions) we can do using vim:

  • d - delete
  • c - change
  • v - visually select
  • y - yank (copy)
  • cc - change the whole line
  • dd - delete the whole line
  • ...

Step 3 Combines verb and movement together, you can see the magic:

  • d5w → delete 5 words
  • dw → delete a word
  • c3w → change 3 words
  • 3dd → delete 3 lines below
  • 5k → move up 5 lines
  • ciw → change a word
  • cit → change a content in a tag
  • ci( → change content between parentheses ()

Now you can combine using this way verb + count or scope + movement and create thoudsands of syntaxes you love.

Step 4 Ignore insert mode as much as possible, using vim to play around with your editor and keep practice untill you can use it without thinking.

The benefits

Easy doing server stuffs

I frequently deploy, debug, and manipulate on servers, and vi is the default editor in UNIX operating systems. Using it has significantly improved my speed and allows me to edit text on the server quickly and efficiently.

Improve coding speed

I know that coding isn't just about typing, but when you type and move around quickly and efficiently, it can enhance your performance.

Conclusion

In my opinion, learning Vim is worthwhile. It only takes one week of practice to learn basic, and you can use it for the rest of your life. So, why not give it a try?