Installing Vim With the Ruby Interpreter and Command-T on Ubuntu

| Comments

I have been working on becoming more proficient in Vim. One of the processes that I have noticed that can take up a lot of time is switching between files. The two examples I have seen are NERD-Tree and Command-T. NERD-Tree looks great, however, I am primarily interested in opening files as quickly as possible. With this criteria, Command-T seems to be the best solution. There are other reasons I am interested in setting up NERD-Tree, but that is for another day.

Here is a quick example of why I chose Command-T. Previously, I would open and switch files like so:

1
2
3
4
5
6
$ vim app/views/articles/show.erb.html
# Complete edits
:wq
$ vim app/model/articles.rb
# Complete edits
:wq

With Command-T, this process is simplified to:

1
2
3
vim
,t avas <enter>
,t ama CTRL t

I have set my leader key to a comma, thus ‘,t’ opens Command-T for me. I can then type letters that appear in the file path, a=app, v=view, and so forth. Amazingly much faster.

The following instructions will install Vim with the Ruby interpreter and Command-T. I keep my vim settings under revision control, thus I have chosen to use Git’s submodules and Pathogen to manage Command-T. Depending on your preferences, you may want to setup Command-T differently. I recommend reading through the Command-T Readme

Install dependencies (what my system required), hg, and rake

1
sudo apt-get install ruby ruby-dev libncurses5-dev mercurial build-essential rake

I chose to compile vim with my system Ruby, 1.8.7. It is important that you use the same version to compile both Vim and Command-T. If your using RVM and you want to do the same, before proceeding you will want to tell RVM to use your system Ruby.

1
rvm use system

Download and build Vim with Ruby

There are several configure options for Vim. Below, you can see what I have chosen. You can see all of the options with:

1
configure --help

Once you have chosen your options:

1
2
3
4
5
hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --with-features=huge --enable-rubyinterp --enable-pythoninterp --prefix=$HOME
make
sudo make install

Check for successful installation “+ruby”

1
2
vim --version | grep ruby
-python3 +quickfix +reltime -rightleft +ruby +scrollbind +signs +smartindent 

Command-T installation via git submodule and pathogen

If your Vim directory is under git, you will want to be at the git root

1
2
3
cd ~/.vim
git submodule add git://git.wincent.com/command-t.git bundle/command-t
git submodule init

Compile Command-T

1
2
cd ~/.vim/bundle/command-t
rake make

Generate helptags in Vim

1
call pathogen#helptags()

You should be all set! If you run into any troubles, please let me know if the comments.

Comments