Skip to content

Instantly share code, notes, and snippets.

@liangzan
Created July 26, 2010 10:00
Show Gist options
  • Save liangzan/490372 to your computer and use it in GitHub Desktop.
Save liangzan/490372 to your computer and use it in GitHub Desktop.
to show rvm in zsh prompt
# add the rvm_info_for_prompt into your prompt
# below is my full prompt
PS1='%{$fg[white]%}%n%{$fg[cyan]%}:%{$fg_no_bold[yellow]%}%3~%{$fg_no_bold[green]%}$(git_info_for_prompt)%{$fg_no_bold[magenta]%}$(rvm_info_for_prompt)%{$reset_color%}# '
# this tests for the presence of rvm
# if its loaded, it'll add the prompt
function rvm_info_for_prompt {
ruby_version=$(~/.rvm/bin/rvm-prompt)
if [ -n "$ruby_version" ]; then
echo "[$ruby_version]"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment