Integralist / ProVim

Repository to hold dotfiles and scripts specific to ProVim
128 stars 67 forks source link

Use of rvm for ruby selection is broken #6

Closed Jaff closed 7 years ago

Jaff commented 7 years ago

Hi, just getting into your proVIM and after switching to zsh and installing your .zshrc on my MacbookPro running 10.11.6, I cannot run rvm. Output result is: ± rvm use ruby-2.2.4

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use /bin/bash --login as the command. Please visit https://rvm.io/integration/gnome-terminal/ for an example.

Integralist commented 7 years ago

Hi Jaff, thanks for the information.

It sounds like the issue isn't with Zsh per se or the .zshrc file in this repo, but more to do with RVM and how it is automatically setup to use a login shell instead of an interactive shell (note: you can manually start a login shell with Zsh using zsh -l).

For me on a Mac, Zsh starts with a login shell by default and so if there was a .zsh_profile it would likely source it I'm guessing.

I can see that RVM states:

RVM by default adds itself currently to ~/.bash_profile file

In that case I would recommend checking the code added to ~/.bash_profile and copying it over to the ~/.zshrc file instead as we know that'll be loaded by either a login shell or an interactive shell.

Alternatively, RVM does suggest a solution here: https://rvm.io/rvm/install

Step 2: Zsh not always sources /etc/profile so you might need to add this in /etc/**/zprofile:source /etc/profile

Hope this helps.

Jaff commented 7 years ago

I got it to work after adding this:

Zsh Hooks {{{

function setup_rvm {
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
    source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
fi
}

I did need to invoke 'setup_rvm' in the shell in order for 'rvm use ruby-2.2.4' to work, although before I did that, I said 'rvm list' and got back the expected response.