Skip to content

Instantly share code, notes, and snippets.

@caad1229
Created May 8, 2015 06:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caad1229/f6c64ef41d58f15f5148 to your computer and use it in GitHub Desktop.
Save caad1229/f6c64ef41d58f15f5148 to your computer and use it in GitHub Desktop.
customized PS1
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/'
}
function promps {
local BLUE="\[\e[1;34m\]"
local RED="\[\e[1;31m\]"
local GREEN="\[\e[1;32m\]"
local WHITE="\[\e[00m\]"
local GRAY="\[\e[1;37m\]"
case $TERM in
xterm*) TITLEBAR='\[\e]0;\W\007\]';;
*) TITLEBAR="";;
esac
local BASE="\u@\h"
PS1="${TITLEBAR}${GREEN}${BASE}${WHITE}:${BLUE}\W${GREEN}\$(parse_git_branch)${BLUE}\$${WHITE} "
}
promps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment