Thursday, September 4, 2008

Why I use vim!!

It's been a while - life and other things have kept me busy. Anyways, what better way to return than to write about something I have not talked much about in the past - technology.

So, coding is my profession - I enjoy coding - nay - love it (given the right circumstances). And one of the biggest weapons in a coder's arsenal is his/her IDE. Well, mine is vim (vi improved). I have been using vim on and off for a few years now - but mainly as a text editor. I had never considered using it as my main development tool until recently (2-3 months back). Boy was I missing out. I've been using it to write everything from Python to HTML/Javascript now and been loving every bit of it.

The main (and rather obvious) reason is it's amazing ability to make text editing fast. Visual mode is the best invention mankind has made since the wheel. It allows me to remove and add text about as fast (maybe even faster) as I can think of doing it. Want a word gone - done. Want a line gone - done. Want to replace a line - line gone, cursor at beginning of line - done. I can keep going on. Gone are the days when you have to use your mouse to select a word, or a whole line. w,b,j,k,h,l allow me to move around in lesser time than it would take me to move my hand off the keyboard, onto the mouse, find the pointer, bring it down to the text I need gone, select the whole thing and hit delete. In-fact, now when I edit text in a browser (like this blogger textbox for example), I find it tedious to delete things, or add things.

But more than that, it's ability to double up as a IDE is what has me truly amazed. The amazing set of plugins around it (for example snippetsEmu) make it a breeze for me to write my code and get the right text in the right place ASAP. Other things like omnicompletion, code highlighting, line numbering, syntax checkers, class definitions etc. are icing on the cake. And the biggest win - it works on all 3 of my development platforms (Win, Max and Linux - yes I work on all 3). Setting it up on my windows machine took some doing (had to compile vim from source) but once it was done, everything worked exactly how it worked on my other machines. No more switching between IDE's and no more learning new commands (thanks, but no thanks, TextMate).

I do have a couple of gripes though - I would like to see some straighforward way to refactor my code and I would like to see integration with my vcs (git). I have tried out a plugin for the latter, but couldn't get it working within the 10 minutes I gave it a shot for.

In anycase, vim is an amazing text editor/IDE and anybody using anything else (with the exception of Eclipse for Java) should consider switching. I haven't tried Emacs, but after learning vim, I don't see any value in it - I've got all I need (and more).

No comments: