Skip to content

Instantly share code, notes, and snippets.

@rafaelgonzalez
Last active August 29, 2015 14:04
Show Gist options
  • Save rafaelgonzalez/d7a798048614f7e1b223 to your computer and use it in GitHub Desktop.
Save rafaelgonzalez/d7a798048614f7e1b223 to your computer and use it in GitHub Desktop.
get_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
colored_prompt () {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREENBOLD="\[\033[1;32m\]"
local YELLOW="\[\033[0;33m\]"
local YELLOWBOLD="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local BLUEBOLD="\[\033[1;34m\]"
local PURPLE="\[\033[0;35m\]"
local PURPLEBOLD="\[\033[1;35m\]"
local CYAN="\[\033[0;36m\]"
local CYANBOLD="\[\033[1;36m\]"
local WHITE="\[\033[0;37m\]"
local WHITEBOLD="\[\033[1;37m\]"
PS1="\n$RED\u$WHITE @ $YELLOW\h$WHITE\[\033[00m\] in $CYAN\w$WHITE$GREEN\$(get_git_branch)$WHITE\n$ "
}
colored_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment