Created
February 1, 2013 22:56
-
-
Save chrisjaure/4694752 to your computer and use it in GitHub Desktop.
My Mac Terminal bash prompt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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