Skip to content

Instantly share code, notes, and snippets.

@krsmurata
Forked from 13k/minimal-prompt.sh
Created June 26, 2010 00:11
Show Gist options
  • Save krsmurata/453620 to your computer and use it in GitHub Desktop.
Save krsmurata/453620 to your computer and use it in GitHub Desktop.
# see it in action: http://www.flickr.com/photos/krsmurata/4733844609/sizes/l/
# with timestamp
minimal_prompt_command() {
if [ $? -eq 0 ]; then
local ARROW_COLOR="\[\e[1;32m\]"
else
local ARROW_COLOR="\[\e[1;31m\]"
fi
local CWD_GIT_BRANCH="`git branch 2> /dev/null | grep '^*' | sed -E 's/^\* (.+)$/\1/'`"
PS1="\n\[\e[35m\]\D{%H%M%S} \[\e[1;34m\]\w\[\e[1;37m\] $CWD_GIT_BRANCH\[\e[0m\]\n$ARROW_COLOR~>\[\e[0m\] "
}
PROMPT_COMMAND="minimal_prompt_command"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment