Getting (Mac)Vim to Work With RVM

3

1

I'm using RVM to manage Ruby installs and Gems, and MacVim to create and edit Ruby files.

I have a key command in my ~/.vimrc mapped to evaluate a loaded Ruby file and print the output. It looks something like this:

map <Leader>r :w! <bar> !ruby %<CR>

Within a zsh shell, the ruby command respects my RVM setting. In MacVim, however, the ruby command loads the default Ruby at /usr/bin/ruby, and it ignores RVM entirely. Is there any way to get MacVim to recognize the Ruby version I set with RVM?

michaelmichael

Posted 2010-08-07T22:24:27.287

Reputation: 849

Answers

2

You might be interested in the vim plugin I've just started working on. It's called rvm_ruby.vim and gives you ex commands that will reach RVM ruby executables.

You'd use something like :Ruby % to reach the ruby version you were using when you launched MacVim (assuming you did it using mvim in a login shell).

There's also a :Gem ex command that targets RVM's gem command.

James Conroy-Finn

Posted 2010-08-07T22:24:27.287

Reputation: 36

that does the trick, and is definitely a better solution than mine. thanks very much! – michaelmichael – 2010-09-27T17:34:34.373