Friday, 24 July, 2015 UTC


Summary

I’ve been using Vim for several months now, which means I’m not even close to some of the professionals, but I still like it a lot. People ask me whether or not it improves my productivity, well It definitely does.
But not in the way you probably think of.
 Wanna edit text faster?
Vim lets you type, navigate and edit text fast. Or even really really fast if you use all of the navigation patterns and keystrokes, understand modes and run macrosses.
The thing is that we as programmers don’t just type text.
The vast majority of our time is being spent thinking about architecture or business domain or tracking some nasty bugs. Not typing. Even though Vim does improve our typing capabilities, it doesn’t improve our overall productivity much by doing this.
So this is not what sells it for me.
 Vim is light
JetBrains RubyMine is very mature. It can do things like syntax checking, fuzzy file and character search, all kinds of refactoring really well. The price for this is that it’s resource-greedy and takes a long upstart time.
Vim starts in the blink of an eye and takes several megabytes of Ram, not gigabytes.
The coolest part is that Vim can also do all this tricky stuff. You can fuzzy search files with ctrlp plugin or check syntax with syntastic.
There are tons of different plugins which probably gonna cover all your needs.
 Vim is environment aware
I like that Vim does not trying to be everything. Instead it provides the means for interacting with external environment allowing you to delegate work to other programs that might do the job better.
One of the most common behaviour for a ruby developers is running specs from Vim. You can run it simply by typing :! rspec %. : sends you to command mode. ! lets you run external command. And % refers to the current file path. Of cause you might wanna define a key mappings for that or use the thoughtbot’s plugin, which essentially does just that.
Another example. When you want to search for a string or regex through the whole project you probably use Ack plugin. And what it does internally when you ask it to look for a string is running the external ack command. You can even configure it to tun ag which does this job even better (faster).
In Vim world you use your environment effectively. Not shutting yourself inside an IDE.
 Just a tool in your toolchain
One of my favourite Vim features is the ability to use external command against the selected text. First you select several lines in visual mode. Then you type :! any-command. Vim takes your text and send it to stdin of external command. Then it replaces the selected text with the command output.
For example I prefer to code in CoffeeScript. But when I “google the stackoverflow” for code examples they are usually in JavaScript. I can’t just take the snippet.
What I do is paste the JS code, select it, then type :! js2coffee (see js2coffee) and voila, now I have it in CoffeeScript.
The point is that you can wait for your preferred IDE to implement some new fancy feature like that. But with Vim you can use it right now. And the reason you can use it is that Vim does not tries to do all the things, but instead allows to delegate work to others.
 Conclusion
Don’t get me wrong. I’m very happy that Vim allows me to type faster and not to use mouse at all. I’ve even forced myself to use hjkl keys instead of arrows recently and now it all feels just natural.
But why I really prefer Vim to full-featured IDEs is that it gives me freedom in choosing ways of doing things.