views:

556

answers:

5

I am trying to move to GVim(cream) as my primary editor on Ubuntu. I am using the wonderful rails.vim, however I also am using RVM.

Rvm works fine when doing things in a shell, and the ruby version I would like to use in rails.vim is the version set as default (but not the system version).

When I try to run things like

:Rgenerate migration migration_name

I get:

...
Missing Rails 2.3.8 gem.
...

If I try:

:!rvm use default

I get:

/bin/bash: rvm: command not found

Obviously cream/gvim is not using my .bashrc. What can I do to remedy this and get it working? Thanks.

A: 

You probably have used .bash_profile to add RVM stuff to your bash environment. Alas, ~/.bash_profile won't normally be read by X startup scripts, as stated in Ubuntu Help

Use .profile or .bashrc. The .profile is only sourced by bash if .bash_profile is not there. I would use .bashrc.

fungusakafungus
Oh, and don't forget to restart the X session after making changes.
fungusakafungus
Thanks. However, I actual already used .bashrc to add rvm. I was mistaken when I said bash profile above.
Alan Peabody
A: 

rvm is a bash function, which changes bash environment. Seems like it is not supposed to be run from inside vim. You can't change the environment of an already-running program.

fungusakafungus
Okay, so it should like What I need to do is launch it from the correct bash profile, perhaps like thomasfedb suggests.
Alan Peabody
+1  A: 

Try running cream from the command line, if this solves the issue you can point your menu item to a script that opens cream in the context of a bash prompt.

thomasfedb
This sounds the most promising. Any suggestions on how to go about doing this? Pointing me towards the right search terms so I can learn myself would be appreciated.
Alan Peabody
thomasfedb
A: 

Try rvm gem list to make sure the rails gem is actually installed. rails (2.3.8) should be listed. If its not run rvm gem install rails.

I'm a vim user, and rvm + rails.vim works fine for me. Including your :Rgenerate example.

rnicholson
RVM is installed, gvim just is not loading is the scope of the bash profile.
Alan Peabody
A: 

rvm is set on a per shell basis, so if you launch a new window or a new tab and you are using something other than your default interpreter and gemset you need to first

rvm gemset use my_rails238_gemset

and then

vim myshiz

Jed Schneider
This is pretty much what I have been doing. Launching gvim from the terminal results in the desired behavior.
Alan Peabody