Programming ≈ Fun

Written by Krešimir Bojčić

Installing Command-T Vim Plugin on Ubuntu 11.04 With Ruby 1.9.2

If you can’t get Command-T plugin to work, or you can get it to work but it breaks Vim frequently with the friendly message noted down, than this post might help you out of your misery…

Vim: Caught deadly signal SEGV
Vim: Finished.

Segmentation fault

I’ve determined two main causes for couple of hours of grief

  • Ubunutu 11.04 Vim build version is 7.3.35 and it has kinda flaky Ruby support with nasty habit of crashing Vim in combination with Command-T on some distributions (Command-T is partially written in Ruby)
  • I have multiple Ruby versions (via RVM). Vim was build with 1.8.7, and I was ‘making’ plugin with 1.9.2 Ruby binding. It turns out this was not such a good idea

First off all you need newer Vim build than the one that is present on Ubunutu 11.04 (you need to have Mercurial installed in order to fetch Vim, I guess Moolenaar has to use Mercurial, since he is employed at Google). Easiest way is to compile it from source, while enabling Ruby support at the same time. I had some strange problems with build version 189 so I’ve chosen build 154 (As I’ve said Ubuntu default is build 35, and they fixed the bug somewhere in between build 35 and 154.)

hg clone https://vim.googlecode.com/hg/ ~/vim
cd ~/vim
hg update -C v7-3-154
./configure --with-features=huge  --disable-largefile \
            --enable-perlinterp   --enable-pythoninterp \
            --enable-rubyinterp   --enable-gui=gtk2 \

make
sudo make install

Check the Vim:

vim --version | grep ruby
Make sure that after checking Vim version you see +ruby, and also make note of version of ruby used (1.8.7, 1.9.2), I got it to work with both but it is important to use same Ruby version when installing the plugin…

Get Command-T script from Command-T Vim page. If you’ve already tried to install Command-T you can implode it (you could say remove it, but it doesn’t sound nearly as cool)

rm -rf ~/.vim/ruby
rm -rf ~/.vim/doc/command-t.txt
rm -rf ~/.vim/plugin/command-t.vim

Then open plugin installer with Vim

vim ~/command-t-1.2.1.vba

While in Vim type :so % into command line and get out of Vim with :q to finish the install

cd ~/.vim/ruby/command-t/
ruby extconf.rb
make

Enjoy the Command-T magic, make sure to steal some cool mappings from Destroy All Software. I have particularly ‘Custom Rails mappings’ in mind…

« What The Heck Are Closures In Ruby? Rake 0.9 is breaking Rails 3 »

Comments

Copyright © 2019 - Kresimir Bojcic (LinkedIn Profile)