Skip to content

Instantly share code, notes, and snippets.

@heuermh
Created March 22, 2019 15:59
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 heuermh/a3b5880714d1082cb9ff2b65317e7a57 to your computer and use it in GitHub Desktop.
Save heuermh/a3b5880714d1082cb9ff2b65317e7a57 to your computer and use it in GitHub Desktop.
Bash prompt
# Generated 2015-09-14 by http://www.gilesorr.com/Code/bpb/ ,
# The Bash Prompt Builder written by Giles Orr.
case ${TERM} in
xterm*|rxvt*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]';;
*)
TITLEBAR='';;
esac;
# Elegant code courtesy of nitrous.io:
parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
parse_git_dirty () {
git diff --no-ext-diff --quiet --exit-code &>/dev/null || echo "!"
}
PROMPT_COMMAND=""
PS1="${TITLEBAR}\[\e[0;34m\]\W \[\e[1;34m\]\$(parse_git_branch)\n\
\[\e[0;32m\]\$ \[\e[1;37m\]"
alias ls="ls -G"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment