Question

I installed rvm and a couple of rubies since i'm working with projects based on different ones. Then created .rvmrc files in project directories and they work perfectly when i 'cd' to projects' folders in my terminal:

~$ cd workspace/prox/
~/workspace/prox$ rvm current
ruby-1.9.3-p194@prox
~/workspace/prox$ cd ../cto/
~/workspace/cto$ rvm current
ruby-1.8.7-p358@openservice
~/workspace/cto$ 

And now i'm trying to use vim + NERDTree as my new ide to improve performance but i encountered a problem with .rvmrc: When i cd in NERDTree to a project's folder and get confirmation that CWD has changed i end up with default ruby@gemset. Hance .rvmrc hasn't got processed. Does anyone know if it is possible to make .rvmrc files work with vim NERDTree?

Was it helpful?

Solution

I'm not a rubyist and, therefore have no practical experience with RVM.

But I seem to remember that it works by setting a bunch of environment variables which are supposed to be picked up by Vim at startup. Am I right?

IMO the problem, here, is that changing a directory in Vim and changing a directory in your shell is not related at all. AFAIK, Vim doesn't care about your .rvmrc and won't notify your shell of any :cd.

See this sequence of commands:

$ cd
$ pwd
/home/username
$ vim
:pwd
/home/username
:cd Dropbox
:pwd
/home/username/Dropox
:q
$ pwd
/home/username

While you have changed to another directory while working in Vim you are back to square one when you quit. Because your shell didn't notice all your travels and Vim didn't pickup any new environment variables you are somehow at the same place with the same environment.

But I might be completely off.

This plugin by Tim Pope should help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top