My Path To Vim Enlightenment

It’s been about 2 months now since I began using Vim as my full-time editor and I can easily say that my productivity has increased as a result. I’m still only scratching the surface of what the editor can do, but I’m confident that this is going to be one of the single best moves I make in my programming career. Not only will it save me time and money  by not trying out every new editor that comes out on the market, but it is a tool that I can use for the rest of my programming career and on any machine I will ever have to code on. I highly recommend integrating Vim into your workflow and hopefully the following resources will make it a lot easier to do so.

I wanted to write and share some of my experiences with the editor, but there are already so many good articles our there I figured I would just share some of the more helpful ones I’ve come across rather than trying to re-invent the wheel. I tried to list the articles in the order I think it would be most beneficial to read them in, but don’t be afraid to jump around or cherry pick through them. Like I said, I’m only scratching the surface with what the editor is capable of so I will make sure to curate this list over time.

Everyone Who Tried to Convince Me to use Vim was Wrong

An awesome article by Yehuda Katz which talks about his transition to Vim. He lets you know that it’s OK to hangout in insert mode most of the time and stick to your usual editing habits when you’re starting out. This way you can at least continue being productive while trying out the editor so you won’t have to switch back to your old editor if you are feeling pressure of a looming deadline.

A Starting Guide to VIM from Textmate

Even if you’re not coming from TextMate, this article has some practical advice for getting started with Vim. This article is what got me to fire up vimtutor for the first time which was a great way to start editing some text and getting a glimpse of the power of Vim.

Learn Vim Progressively

Probably my favorite Vim article I’ve ever read, or at least the one I got the most out of. It has some great advice on learning Vim and covers some incredibly helpful commands. It was also the first time I saw the power of out Vim Macros.

The Vim Cheat Sheet for Programmers

There are a lot of Vim cheat sheets out there, but this is the one that I keep on-hand and have found to be the most complete and easy to find what I’m looking for.

Anything Else?

Well that’s a starting point, but definitely not a complete list of the articles that have helped me in learning to use Vim. I’m sure this will continue to grow over time.

Getting Started with Vim

I’m giving Vim a try for the next 30 days (well, 27 days now) as my only editor. I just switched over to a Macbook Air as my main development machine so I am not even going to install TextMate or any other editors besides MacVim. I’ve made a couple attempts in the past at getting into Vim, but I just found myself getting frustrated at how unproductive I was and I quickly switched back to TextMate.

I’m already a couple days in to the challenge and have really enjoyed learning about all the editor has to offer. Partially to keep myself accountable to the challenge and partially to help others who are trying to make the switch to Vim, I’m going to be sharing my experiences here along the way. I’ll be giving my perspective coming from TextMate to Vim but I will try to share any tips and tricks I learn along the way that I find are improving my productivity.  I’d also be happy to answer any questions people have, so feel free to ask away in the comments.

The First Few Days

I’m already a few days in to the challenge and have had my fair share of struggles figuring out how to do things that were already part of my workflow in TextMate. I’m getting fairly comfortable with the editor and I would say that I’m about 90% as productive as I was previously in TextMate and I still have a lot to learn.

Here are a few things things that have been important to my adoption of the editor.

Multiple Editing Modes

This was tough to get used to at first. Remembering to switch between insert, visual and normal mode was a bit of a pain and I found myself typing a lot of nonsense when I would forget to jump in or out of a certain mode, but I’m pretty much past that. I’m already enjoying a lot of the commands that are available in normal mode and I would probably miss them if I were to make the switch back at this point.

Working with Multiple Files

One of the biggest differences with MacVim and pretty much any GUI editor out there is that you don’t have a file tree to look through and open files. Opening files with the default command (:e) is a bit of a pain, especially in large projects, but I realized that PeepOpen could bring back the awesome Go to File… command from TextMate (Command + T). This alone was a huge time saver.

If you haven’t heard of PeepOpen, you should check it out. If you are a MacVim or TextMate user, it is an awesome add on that can help you a lot when working with multiple files.

Learning My First Few Commands

To get my feet wet with Vim I tried out the built-in vimtutor that comes with the editor. It was a great introduction and easily worth the 45 minutes or so it took to get through it. Even if you aren’t using Vim on a regular basis, I would highly recommend it to anyone who has to do any editing of files over an SSH connection just so you have the basics of Vim under your belt for those few occasions that you actually have to use it.

To start vimtutor, just go to your Terminal and type vimtutor. That’s all there is to it! It’s really just a big text document that walks you through the Vim commands, but it’s very well done and covers all the basics you need to get started.

Next Steps

I’m still trying to work my way to some more advanced features, but am hoping to get through the Smash Into Vim screencasts from PeepCode in the next couple weeks. I am starting to get the hang of finding and replacing in Vim, but it takes me a while yet so I want to practice up on my regular expressions and understand all the possibilities of the vimgrep command. I also haven’t done any remote editing but am excited to try working with files over SSH.

What I Miss

Although there are a lot of things I like more about MacVim, there are a few things that I really miss.

  • Bundles – not a dealbreaker, but it would be nice to have some of my old bundles for PHP/CodeIgniter and Ruby/Rails.
  • Git Integration – I loved the Git bundle for TM and used it for all of my commits.
  • Find in Project – I used this command all the time, and it will take me a while to get used to finding and replacing in Vim.

I’m guessing all of these issues are not shortcomings of the editor, but only my lack of knowledge about it.