Installing Command-T Plugin in MacVim

Recently I’ve switched to MacVim from Textmate, and done so for a couple of reasons:

  • I use Vim remotely when administering servers all the time, and practicing it locally makes me much more productive.

  • Vim is evidently more mature than Textmate. With the whole Open Source ecosystem around it, tons of plugins and superior text-editing features, it leaves Textmate far behind.

Of course, programming doesn’t happen in the editor, but you have to transfer your thoughts to the screen somehow and that’s where your tool chain comes into play. I found that after several days of practice MacVim started to feel at home and the fact that I keep discovering shortcuts makes it a game where you unveil more and more hidden goodness. Love the feeling…

One thing that I missed was a quick file opener that lets me type a part of the file name and pick the right one to edit from a popup dialog. There are tens of plugins to handle this from different angles, but I found [Command-T][] to be the one I’m the most familiar with. Even though the scoring of results is a bit off and it usually suggests some random crazy stuff, the job it does is usually satisfactory to say the least.

Despite the ease of installation as it is described in the doc, there were some minor hiccups I’d like to shed some light on. Here’s what you need to do:

  • Make sure you use the same Ruby version your MacVim was built with. Usually it’s the system Ruby, and so if you use RVM, you switch back with rvm use system.

  • Make sure the architectures match. MacVim that I use was built for the i386 platform, but I myself am running an x86_64 machine. These two are incompatible and so, when you are be building Command-T native code, by default you use x86_64. MacVim will refuse to load it later. To check the arch of MacVim is easy. Call mvim --version and look for -arch in the last two-three lines. If you find it doesn’t match your system architecture, here’s what you need to do:

    Instead of:

    $ rake make

    You do:

    $ cd ~/.vim/bundle/command-t
    $ env ARCHFLAGS="-arch i386" rake make

After you finished building, restart MacVim and try opening the box as it’s mentioned in the Command-T doc.