Skip to content

Instantly share code, notes, and snippets.

@turbohz
Last active August 23, 2016 13:40
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 turbohz/3dc36c4a77cb19be4ca8c36229315c2f to your computer and use it in GitHub Desktop.
Save turbohz/3dc36c4a77cb19be4ca8c36229315c2f to your computer and use it in GitHub Desktop.
#! /bin/bash
. ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUPSTREAM='auto,verbose'
GIT_PS1_STATESEPARATOR='/'
GIT_PS1_SHOWCOLORHINTS=1
_PS1=$(printf "\n%*s\r/%s" "$((105+$(tput cols)))" '$(_PS="$?";_PSC=$([[ $_PS -ge 1 ]] && echo "\\x1b[1;31m" || echo "\\x1b[0;32m" );printf "${_PSC}%3s\x1b[0m" $_PS)\\\t\' '$(printf "\x1b[30;1m%s/\x1b[0m" $_PWD)')
PROMPT_COMMAND='export _PWD=$(echo "$PWD" | sed -r "s#^$HOME#~#"); __git_ps1 "$_PS1" "\n\[\e[1;32m\]>\[\e[0m\] \[\e[30m\]" "%s";'
trap 'echo -ne "\e[0m" ' DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment