Resounding Questions

There's so Much to Know

Command-T and RVM: The MacVim Conundrum

Janus, MacVim and the Command-T Problem

Listening to The Changelog introduced me to Janus, a collection of Vim plugins all wrapped up in an easy to install package. It’s open source, and socially hosted on Github.

The wonderful thing about Janus is that after 13 years of Vim use, it’s finally introduced me to the world of Vim plugins. This is something I clearly couldn’t/certainly didn’t discover easily by myself. The project as a whole isn’t without some odd quirks, but these are largely down to the design goal of being a Vim-for-beginners-who-come-from-TextMate.

This TextMate focus means two things:

  1. they activate keybindings and some plugins only on detecting a visual Vim – ie GVim or MacVim.
  2. Important plugins are those that replicate TextMate behaviour.

As a result, I have temporarily switched to using MacVim and GVim to experience the plugins at full strength. However when I first did this on OS X, I found a problem. I pulled in MacVim from Macports, and Janus from Github. When I fired it up:

1
2
Vim: Caught deadly signal SEGV
Vim: Finished.

Ah. Confused, I tried running plain vim from the command line – and it didn’t crash out. Hmm. Tricky.

It turns out this was caused by Command-T and MacVim (or Vim more generally) improperly interacting. Command-T is a useful plugin that replicates TextMate’s open-a-file-by-typing-its-name behaviour. It uses the Ruby interpreter in Vim to provide this functionality. And it turns out that if the Ruby versions used to compile Command-T is different to the version used to compile Vim, you’re a bit screwed. Because Fink and Homebrew install precompiled binaries, and you’ll need to be using the default Ruby install that came with your version of OS X. The Macports install sensibly uses the version of Ruby you installed through it. In all three of these cases, you probably won’t encounter the above problem, especially if you don’t use Ruby as a programming language.

However, I’m a Rubyist, and use Wayne Seguin’s RVM to manage my Rubies, and thus I was in a bit of trouble. My MacVim was installed using MacPort’s Ruby, and so MacVim was crashing. Vim wasn’t crashing, because Command-T isn’t loaded by Janus’ vimrc file, only its gvimrc.

Actually, this can happen to any of the plugins that use the linked interpreters: Python, Perl or Ruby, if the interpreter moves. RVM is the source of a lot of this pain though. Just search for the above string in Google, as I did.

The Self Compilation Solution

To solve this, I ended up compiling MacVim from source. I actually struck another problem here, to do with Macports. Essentially, the configure step mentioned in the Github wiki doesn’t take account of the Macport library locations, and so the build fails with an error about iconv. As usual, the Internet comes to the rescue.

I now have a shiny working MacVim install on two machines, after a wee bit of digging into various helper projects. Happy days.