A coworker asked me the other day.
Why Vim, what do you like so much about it?
I would dare say everyone who encounters Vim has a similar story. Many years ago, while on a linux machine I first encounted Vim. It was a simple way to edit text on the server. It didn’t make sense, but it worked. That was the extent of engagement with Vim for about 10 years, just being able to do simple editing of text. More than a handleful of times I would get into some mode that I would not know how to get out of and have to force quit my session.
If you feel dumb, you’re in a good place, you’re learning.
Then a lot of developers that I admired would either show their screen during a presentation or screencast and they would be using Vim. Maybe it was Felix Geisendörfer, who said While vim may not help you to impress the ladies, it will please our BDFL and your grandpa will also approve. He’s not the only prolific developer that uses Vim, there are others and it made me think “Hey, maybe there is more to this Vim thing that first meets the eye”.
The article that by far helped me get starte with Vim was Learn Vim Progressively. The key is, get the basics down, then gradually learn more. Vim is not a, read the manual once and master it, but rather a 10 year plan. It’s old and odd at first, but the odd is there for good reasons.
Back to our question
Why Vim, what do yo like so much about it?
Here are a few of the features of Vim I use everyday, that make my life so much easier. Some of these you can find in other editors, but Vim really shines.
1. Replace inside quotes, parenthesis, brackets, you name it
Let’s say you have some code like such:
var song = "I'm a little tea pot";, and you want to replace it with
var song = "We will, we will, rock you". In Vim you simply place your cursor inside the quotes and press
ci". This means
Quotes ("). This will clear out everything inside the
" and you can begin typing what you want.
This works for any enclosing characters,
''; would be