Fixing Command-T for Vim in Ubuntu 12.04

The Command-T Vim plugin gives you a TextMate style “Fuzzy search” for files in the current directory tree. Basically, you can hit a button and start typing the bits of the file name you remember and Command-T will show you a set of search results.

On my first attempt to build and use Command-T it caused a seg-fault whenever I activated it. This is because Vim in the Ubuntu apt repo was built with the ancient ruby 1.8.7-p352, and Command-T only works when run under the same version which Vim was built with. If you install vim (or gvim/vim-gnome) from the package repos but get ruby from somewhere else, you’ll need to do the following:

Get a copy of Command-T by following the readme. I use pathogen to load my vim plugins, so I cloned the Command-T git repo in my .vim/bundle folder.

Navigate into the folder Command-T extracted or cloned to.

Run `ruby –version`

If you get the answer “1.8.7-p352”, congrats, go to 3 (argh, I used a goto!)

If not, try setting your ruby to the system default.

rvm users should run `rvm use system`,

rbenv users can use `rbenv local system`.

If you don’t see version 1.8.7-p352 now, we’ll install it. rvm users run `rvm install 1.8.7-p352`, wait for the compile to finish and then run `rvm use 1.8.7-p352`