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:

  1. 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.
  2. Navigate into the folder Command-T extracted or cloned to.
  3. Run `ruby –version`
    1. If you get the answer “1.8.7-p352”, congrats, go to 3 (argh, I used a goto!)
    2. If not, try setting your ruby to the system default.
      1. rvm users should run `rvm use system`,
      2. rbenv users can use `rbenv local system`.
    3. 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`
  4. Now that’s sorted, lets build Command-T. First, cd into “ruby/command-t/”
  5. Run `ruby extconf.rb && make` to actually do the build
  6. Congrats, it should be built and working. Hit “<leader>t” in Vim and you should get the search box. Type in the name of your file and see if it completes!

I hope this helps, if not you can try loading my vim config and see if the Command-T I have built there works for you.


Networking VirtualBox VM’s in 7 Easy Steps

I love working on an Ubuntu virtual machine run on a Windows 7 host; I use this set up both at work and at home and will no doubt espouse the benefits of it on the blog at some point (until then check out this post by Ryan).

My software of choice is the free and excellent VirtualBox by Sun Oracle, which can be found here. Much of my work requires me write deployment scripts which set things up on multiple servers. To test this I found it really useful to set up a network between all of my VM’s, which isn’t as straightforward as it could be. Here’s how I got it going:

  1. Shutdown all VM’s, exit VirtualBox and open a command line
  2. Change directory into your VirtualBox folder (it should contain VBoxManage.exe)
  3. Execute the following commands, where vm01 and vm02 are the VirtualBox names of the VM’s:
  4. VBoxManage modifyvm “vm01” –nic2 intnet

    VBoxManage modifyvm “vm01” –intnet2 intnet

    VBoxManage modifyvm “vm02” –intnet2 intnet

    VBoxManage modifyvm “vm02” –nic2 intnet

    This configures a 2nd NIC on each VM, connected to the “intnet” internal network.

  5. Launch each VM
  6. Edit VM01’s network config, assigning a static IP (eg and adding the default gateway as the same as the gateway on NIC1 (the original NIC)
  7. Edit VM02’s network config with the same details but with a different IP on the same group & subnet (eg
  8. Try to get the 2 machines to ping one another, they should be working fine now!