Skip to content

Instantly share code, notes, and snippets.

@holmesal
Created March 4, 2015 23:13
Show Gist options
  • Save holmesal/76235500b324fe200ef4 to your computer and use it in GitHub Desktop.
Save holmesal/76235500b324fe200ef4 to your computer and use it in GitHub Desktop.
color
function color_my_prompt {
local __user_and_host="\[\033[01;32m\]\u@\h"
local __cur_location="\[\033[01;34m\]\w"
local __git_branch_color="\[\033[31m\]"
#local __git_branch="\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`"
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __prompt_tail="\[\033[35m\]$"
local __last_color="\[\033[00m\]"
local __bolt_color="\[\033[31m\]"
#export PS1="$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail$__last_color "
export PS1="\[\`if [[ \$? = "0" ]]; then echo '\e[32m\h\e[0m'; else echo '\e[31m\h\e[0m' ; fi\`:\w $__git_branch_color$__git_branch\n\[\033[01;33m\]⚡ $__last_color"
}
color_my_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment