Skip to content

Instantly share code, notes, and snippets.

@emgoeddel
Last active July 20, 2018 15:16
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 emgoeddel/3209638 to your computer and use it in GitHub Desktop.
Save emgoeddel/3209638 to your computer and use it in GitHub Desktop.
Lizzie's bash prompt
#Paste into .bashrc for git branch in the prompt!
#Plus colors: username in green, @ in default, hostname in blue, pwd in purple, $ and remaining text in default.
#Looks good if you're using black background, white/gray text.
#If you're in a git repository, branch appears in cyan.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
# Custom bash prompt via kirsle.net/wizards/ps1.html with some manual
# changes
export PS1="\[$(tput setaf 2)\]\[$(tput bold)\]\u\[$(tput sgr0)\]@\[$(tput setaf 4)\]\[$(tput bold)\]\h\[$(tput sgr0)\]: \[$(tput setaf 5)\]\[$(tput bold)\]\w\[$(tput sgr0)\]\[$(tput setaf 6)\]\[$(tput bold)\]\$(parse_git_branch)\[\033[00m\] \[$(tput sgr0)\]$\n\[$(tput sgr0)\]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment