Skip to content

Instantly share code, notes, and snippets.

@chrisjaure
Created February 1, 2013 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisjaure/4694752 to your computer and use it in GitHub Desktop.
Save chrisjaure/4694752 to your computer and use it in GitHub Desktop.
My Mac Terminal bash prompt.
# Set the prompt
# This will show something like:
#
# chris@chris-ubuntu in ~
# ›
PS1='\n\[\033[01;35m\]\u@\h\[\033[00m\] in \[\033[01;34m\]\w\[\033[00m\]\n› '
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='set_tab_title'
;;
*)
;;
esac
# set tab name to basename or git repo (branch) if in git dir
function set_tab_title() {
GIT_PS1_SHOWDIRTYSTATE=true
local GIT_PS1=$(__git_ps1)
if [ "$GIT_PS1" ]; then
printf "\e]1;$(greadlink -m $(__gitdir)/../ | xargs basename)$GIT_PS1\a"
else
printf "\e]1;$(basename $(pwd))\a"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment