Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save indrekj/394577 to your computer and use it in GitHub Desktop.
Save indrekj/394577 to your computer and use it in GitHub Desktop.
# Prompts
autoload colors ; colors
git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
rvm_version() {
gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
if [ "$gemset" != "" ] && [ "$version" != "" ]; then
echo "$version%%$gemset"
fi
}
prompt_info() {
git=$(git_prompt_info)
if [ "$git" != "" ]; then
rvm=$(rvm_version)
if [ "$rvm" != "" ]; then
echo " [$git $rvm]"
else
echo " [$git]"
fi
fi
}
PROMPT='%n@%m%{$fg[green]%}$(prompt_info)%{$fg_bold[blue]%} ~ %{$reset_color%}'
RPROMPT=' %~' # prompt for right side of screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment