Command-t is an excellent file browsing plugin for the Vim editor. For more information about the plugin, including screencasts demonstrating it in use, see the Command-t website. Really, go on. If you haven't tried Command-t yet, spend a couple of minutes watching the screencast. You'll love it.
So why am I writing this post when there already is plenty of information available on this subject? Well, I tried installing Command-t using the installation instructions, but Vim kept segfaulting:
$ vim Vim: Caught deadly signal SEGV Vim: Finished. zsh: segmentation fault vim $
This is how I got it working. First off, make sure that Vim is compiled with support for ruby. One can check this by typing vim --version in the terminal, and look for the word 'ruby' in the list of features. If the word is prefixed by a plus sign you are good to go, if not you will have to reinstall vim with ruby support. Doing this is simple enough using MacPorts:
$ sudo port install vim +ruby
Go grab sufficient amounts of coffee, tea or whatever your favourite beverage is and await the compilation to finish. Once done, it is time to grab the Command-t source code. This can be done by browsing the Command-t website and grabbing the latest release. If you keep your Vim configuration in a git repository, like me, you could add the Command-t repository as a submodule, as described in the README. In this blog post, however, I am assuming that you simply downloaded the Command-t vimball and that it is now sitting in your Downloads folder. To extract the vimball, simply open the file in Vim, and source it (as Vim tells you to at the bottom of the screen):
$ cd ~/Downloads $ vim command-t-1.4.vba
A lot of lines will come up, telling you about files that have been extracted and written. Don't be tempted to hit q, simply hit space until you reach the bottom. Then exit vim with :q. It is now time to compile the parts of Command-t that were written in C:
$ cd ~/.vim/ruby/command-t $ /opt/local/bin/ruby extconf.rb checking for ruby.h... yes creating Makefile $ make ...
Using the full path for ruby when interpreting extconf.rb is crucial; you will want to make sure you use MacPorts ruby for this, and not the version of ruby provided by OS X. When the compilation is done (should only take a few seconds), you should be ready to go! Try start vim and hit <leader>-t.