Why I Use Vim
I've been using MacVIM as my editor of choice for a couple of years now, yet in many ways I still feel like a beginner. Every day I am learning more and more about my editor, but it takes a conscious effort to become proficient with an editor like Vim. Here's why I make that effort.
Editors are something that are very personal; they have to fit with your own work flow approach to programming. If you have ever stopped to think about it, the way each person goes about editing text is quite different. I frequently pair program with colleagues and I find it amazing, and sometimes frustrating, to see how others go about editing. For instance some people are delete and insert kind of people, others prefer to insert and then delete, some are poor typists and prefer to do copy and paste editing, and others are overwrite folks.
It's also not just a general difference in approach; the differences are contextual. For instance, your editing approach when deleting multiple whole lines is very different from your approach to just editing a single line. It's also different if you're editing content in the middle of the line versus editing at the beginning or the end of the line. Approaches to find and replace are also widely varied. I point all this out because at the end of the day you are best served by having an editor that is able to be customized to work best with your natural approach to editing. For me Vim is that editor, yet there are many other great alternatives.
The downside to something like Vim, and other highly configurable editors, is that it does require an investment of time to see the real benefits of it. I have several friends that desire to learn Vim but aren't willing to make the investment to switch from something like TextMate. Thankfully there are quite a few resources out there to help you get up to speed quickly.
- PeepCode Screencasts - Their offerings of Smash into Vim and Smash into Vim 2 are great videos to help you get started with Vim. I learned some fundamental things about Vim in these screencasts that I wasn't aware of previously. I also find them real gems to visit again and again. Well worth the money.
- VimCasts - Free short videos highlighting features of Vim. VimCasts is produced by Drew Neil. These are high quality professionally done trainings. A highly recommended addition to your podcast reader.
- Vim Scripts - Part of the Vim site that is devoted to third-party plugins to expand the capabilities of Vim. It's well worth your time to find plugins that make things easier. For instance, I have a plugin that highlights errors in my Python code as I type, such as finding unused imports or making sure my code is PEP8 compliant. I have a plugin that makes commenting painless.
- Justin Lilly's Vim Screencasts - My good friend Justin Lilly has a number of great screencasts on Vim. Additionally, his post titled Vim: My New IDE is an excellent introduction to some of the plugins available on Vim.
One other thing that will get you up to speed on Vim is to start with someone else's Vim configuration. Mine is available on GitHub. I caution you to not adopt a complex Vim configuration until you have the basics down. The main reason being is that some configurations alter basic builtin behavior. For instance in my configuration I disable navigation using the arrow keys. If you're not aware of this it could impact your understanding of what are Vim defaults and what things are modifications.
One of the big advantages for me in using Vim is that it's available on every platform that I work with. This means I don't have to context shift when I'm editing configuration files on the server, or writing .NET code.
I hope you take some time to check out the above resources and consider using an editor like Vim. It's an ongoing investment but certainly worthwhile.