Skip to content

Instantly share code, notes, and snippets.

@gordolio
Created August 7, 2011 21:46
Show Gist options
  • Save gordolio/1130827 to your computer and use it in GitHub Desktop.
Save gordolio/1130827 to your computer and use it in GitHub Desktop.
myps1
# placed in a function to avoid mucking up my env
# screenshot: http://gordonchild.com/ps1.png
function setps1 {
local E="\[\033["
local D="\]"
local YELLOW="${E}1;33m${D}"
local BROWN="${E}0;33m${D}"
local RED="${E}31m${D}"
local WHITE="${E}1;37m${D}"
local ON_BLUE="${E}44m${D}"
local ON_YELLOW="${E}43m${D}"
local ON_GREEN="${E}42m${D}"
local ON_RED="${E}41m${D}"
local ON_BLACK="${E}40m${D}"
local NO_COLOR="${E}0m${D}"
# found using
# echo -n λ | hexdump
local LAMBDA="\`echo -e -n \"\xCE\xBB\"\`"
local GIT_BRANCH="\`ruby -e \"print (%x{git branch 2> /dev/null}.split(/\n/).grep(/^\*/).first || '').gsub(/^\* (.+)$/, '[\1] ')\"\`"
export PS1="$RED\
$GIT_BRANCH\
$WHITE$ON_BLACK\u@\
$YELLOW$ON_BLUE\h\
$WHITE$ON_BLUE \w\
$NO_COLOR\r\n\
$YELLOW$LAMBDA\
$BROWN "
}
setps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment