Skip to content

Instantly share code, notes, and snippets.

@timgentry
Last active August 29, 2015 14:06
Show Gist options
  • Save timgentry/20b2b8add3c711e415e3 to your computer and use it in GitHub Desktop.
Save timgentry/20b2b8add3c711e415e3 to your computer and use it in GitHub Desktop.
Coloured prompt with ruby version and git branch name
# Git branch based prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1 /'
}
# ruby version based prompt
function parse_ruby_version {
eval "rbenv version-name"
}
function proml {
local GREEN="\[\033[0;32m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local RED="\[\033[0;31m\]"
local NO_COLOUR="\[\033[0m\]"
PS1="$RED\$(parse_ruby_version) $LIGHT_GRAY\u@\h \w$GREEN\$(parse_git_branch)$NO_COLOUR\$ "
}
proml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment