Skip to content

Instantly share code, notes, and snippets.

@chy168
Last active August 29, 2015 14:00
Show Gist options
  • Save chy168/11323768 to your computer and use it in GitHub Desktop.
Save chy168/11323768 to your computer and use it in GitHub Desktop.
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\{\1\}/'
}
if [ "$WINDOW" == "" ] ; then
# PS1="\[\e[1;36m\]\u\[\e[31m\]@\[\e[33m\]\H\[\e[35m\][\w]\[\e[34m\]{\A}\[\e[0m\]\\$ "
# PS1="\[\e[1;36m\]\u\[\e[31m\]@\[\e[33m\]\H\[\e[35m\][\w]\[\e[34m\]\$(parse_git_branch)\[\e[0m\]\\$ "
# PS1="\[\e[1;36m\]\u\[\e[31m\]@\[\e[33m\]\H\[\e[35m\][\w]\[\e[34m\]\$(parse_git_branch)\[\e[0m\]\e[\nm\]\e[30;48;5;105m\\$\e[m "
# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1='\[$(tput bold)\]\[$(tput setaf 6)\]\u\[$(tput setaf 1)\]@\[$(tput setaf 3)\]\h\[$(tput setaf 5)\][\w]\[$(tput setaf 4)\]`parse_git_branch`\n\[$(tput setaf 2)\]\\$ \[$(tput sgr0)\]'
else
PS1="\[\e[1;36m\]\u\[\e[31m\]@\[\e[33m\]\H\[\e[35m\][\w]\[\e[34m\]{\A}\[\e[32m\]($WINDOW)\[\e[0m\]\\$ "
fi
# improve bash history
shopt -s histappend
# export PROMPT_COMMAND="$PROMPT_COMMAND; history -a"
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment