Skip to content

Instantly share code, notes, and snippets.

@bradynpoulsen
Created July 29, 2014 20:12
Show Gist options
  • Save bradynpoulsen/7aa09ee582bec3d205c8 to your computer and use it in GitHub Desktop.
Save bradynpoulsen/7aa09ee582bec3d205c8 to your computer and use it in GitHub Desktop.
function bash_prompt {
local EXIT="$?"
# Text Color
# local BL="\\[`tput setaf 0`\\]" # Black
local RD="\\[`tput setaf 1`\\]" # Red
local GR="\\[`tput setaf 2`\\]" # Green
local YE="\\[`tput setaf 3`\\]" # Yellow
local BU="\\[`tput setaf 4`\\]" # Blue
# local MA="\\[`tput setaf 5`\\]" # Magenta
local CY="\\[`tput setaf 6`\\]" # Cyan
# local WH="\\[`tput setaf 7`\\]" # White
local ESC="\\[`tput sgr0`\\]"
# local AP=$'\xe2\x9c\x88' # Airplane
# local RA=$'\xe2\x98\xa2' # Radioactive
# local PF=$'\x28\xe0\xb8\x87\x27\xcc\x80\x2d\x27\xcc\x81\x29\xe0\xb8\x87' # Pissed off face
local SA=$'\xe2\x9f\xbf ' # Squiggly Arrow
export PS2="${YE}${SA} ${ESC}"
export PS1="$ESC\u:$CY\W " # Path information
export PS1="${PS1}${BU}`__git_ps1 "[%s] "`" # GIT Information
export PS1="${PS1}$(if [[ $EXIT -eq "0" ]]; then echo -n $GR; else echo -n $RD; fi)[\@] " # Display Current Time in success color
# if [[ $EXIT -eq "0" ]]; then # Last command was successful
# export PS1="${PS1}${GR}${RA}\n${PS2}"
# else
# export PS1="${PS1}${RD}${PF}\n${PS2}"
# fi
export PS1="$PS1$PS2"
export PS4="- "
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWUPSTREAM="verbose"
export GIT_PS1_DESCRIBE_STYLE
export GIT_PS1_SHOWCOLORHINTS=true
# Update Terminal CWD (default PROMPT_COMMAND)
local SEARCH=' ';
local REPLACE='%20';
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}";
printf '\e]7;%s\a' "$PWD_URL"
}
export PROMPT_COMMAND="bash_prompt;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment