Skip to content

Instantly share code, notes, and snippets.

@mpiette
Created September 2, 2016 16:05
Show Gist options
  • Select an option

  • Save mpiette/820d9a26ef66f4a810db4138a092a94f to your computer and use it in GitHub Desktop.

Select an option

Save mpiette/820d9a26ef66f4a810db4138a092a94f to your computer and use it in GitHub Desktop.
Pretty PS1
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1="\[$(tput setaf 6)\]\u\[$(tput setaf 7)\]@\[$(tput setaf 2)\]\h\[$(tput sgr0)\]\[$(tput setaf 7)\]:\[$(tput sgr0)\]\[$(tput setaf 5)\]\W\[$(tput sgr0)\]\[$(tput bold)\]\[$(tput setaf 3)\]\$(parse_git_branch)\[$(tput sgr0)\]\[$(tput setaf 7)\] \\$ \[$(tput sgr0)\]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment