Closed x-yuri closed 9 years ago
Run chruby in the terminal, then run your text editor of choice. For temporary shell sessions, use the :sh
vim command to drop down to a shell.
I almost forgot, we already have some tips on Vim integration on the Wiki.
So from what I can tell, chruby
creates a shell function of the same name, which is not inherited. And I'm supposed to have /usr/local/share/chruby/chruby.sh
sourced in the current shell before doing anything. Is this all I've got to do? Does the state get inherited, like current ruby version?
You must source chruby.sh
/ auto.sh
in your Shell Configuration, that way chruby is loaded into every shell and sub-shell.
Okay, I looked into it. /usr/local/share/chruby/chruby.sh
defines a shell function of the same name, which is not inherited. So, for it work /usr/local/share/chruby/chruby.sh
must be sourced in every shell where this function is needed. Which means system-wide setup doesn't makes much sense. I need to put it into ~/.bashrc
anyway, unless I want to use it in only login shells:
$ chruby
ruby-2.0.0-p247
* ruby-2.1.5
$ bash
$ chruby
bash: chruby: command not found
As for the state, it's stored in environment variables which are inherited. That is, no need to source /usr/local/share/chruby/chruby.sh
unless you're going to switch to different ruby
.
I enabled
chruby
system-wide and now the easiest way to run it fromvim
ormc
I can think of:And to run something with some specific version of
ruby
:Am I doing it wrong? Is there an easier way?