If you’ve been keeping your ears open over the last few months you’ll have heard noises from a number of folks who have been talking vim up as a replacement editor.
On the other hand there have been people like Yehuda Katz claiming that it’s all hype and everyone should go back to their homes and shut the doors because the crazies will be gone soon (ok, I’m paraphrasing a lot there).
Of course, all of this made me chuckle and scratch my head at the same time.
Why? Because 20 years ago I was C++ on unix, using vi, as part of my Uni degree. I even wrote a vi clone as one of my Uni team projects! At the time I knew how to get around the editor reasonably well, though by no means was I a ninja, but I also thought it was as ugly as warts on your bum and compared to just being able to edit text the way you could with every other editor in the world at the time other than emacs, all that switch in/out of edit mode just felt like overhead.
As Uni turned into career I started worked on platforms and languages where vi didn’t exist (Wang VS, VAX/VMS, Linux, Windows, 4GLs, VB4+, Visual Studio, etc) and I gradually forgot all my vi editing skills, got used to living in a constant edit mode and never missed vi for a minute.
That said, it’s always good to question what you do and how you do it, and so if vi is being picked up by a whole new generation of developers then maybe this old fossil had better challenge his assumptions and re-evaluate wether vi is better than what I’m using currently and cut through all the talk with a little bit of personal experience. That said, I didn’t really want to lose my Visual Studio IDE and all the goodness ReSharper brings to it and my usual development workflow (i.e. the stuff that goes beyond just typing code) so I actually wanted the best of both worlds.
And thankfully it turns that there is something like this out there. There’s a Visual Studio add-in that brings all the good bits of vi into Visual Studio called viemu and I’ve been using it for a while now and really liking it. The guys who make it have also put together a great article explaining why people use vi/vim, and what some of the problems are in adopting it. It’s well worth a read and just as soon as you finish reading this post you should go have a read of that one as well.
Now, I will say up front that viemu is a commercial product, but since it has a 30-day trial there’s plenty of time for you to work out wether viemu will help you or not. Personally, I’ve found it improving my productivity quite a lot and it’s really reduced my hand movements and mouse usage even more than R# did, so I’ve gone and acquired a licence.
One of the issues I had initially was clashes with other extensions I have loaded (I have quite a few) so if you have ReSharper, the Visual Studio 2010 Productivity Power Tools or other similar extensions loaded then you may need to turn off a few options in them. What sort of clashes, you ask? Well, as vi uses a normal keyboard characters for navigation such as braces, brackets and parentheses other extensions pick up the key presses and think they are just normal typing so they go ahead and helpfully auto insert the matching closing characters, leaving random characters littered around your code if you’re not paying attention. Just go into your tools and find the relevant auto completion options and turn them off.
I should also mention, there’s a very handy shortcut to enable/disable viemu at any point in VS2010 so if someone else comes to your machine to do some pairing you can easily switch it off, let them work the way they wish and switch it back on when you have the keyboard again. Nice!
Finally, if you’re just learning the vi/vim commands I’d recommend you run through the visual cheat sheet and tutorials on the viemu site. It really helped me a lot in that regard, and made adoption much quicker. So with that said, if you want to save your hands and wrists then go download it and give it a try today. I’m really enjoying it, and you may just do so too!