Last active
December 16, 2015 06:09
-
-
Save FrancoB411/5389132 to your computer and use it in GitHub Desktop.
my .bashrc with custom prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Add RVM to PATH for scripting | |
| PATH=$PATH:$HOME/.rvm/bin | |
| ### Add bin to my PATH | |
| PATH=$HOME/bin:$PATH | |
| ### Added by the Heroku Toolbelt | |
| export PATH="/usr/local/heroku/bin:$PATH" | |
| ### Adds RVM as a function | |
| [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
| ### Adds Postgres to Path | |
| export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH" | |
| ### Adds color to ri | |
| alias ri='ri -f ansi -T' | |
| ### Add Git Status to bash prompt | |
| function prompt_command { | |
| exitstatus="$?" | |
| BOLD="\[\e[1m\]" | |
| RED="\[\e[0;31m\]" | |
| REDBG="\[\e[41m\]" | |
| BLACKBG="\[\e[40m\]" | |
| GREEN="\[\e[32;1m\]" | |
| BLUE="\[\e[34;1m\]" | |
| PURPLE="\[\e[35;1m\]" | |
| CYAN="\[\e[36;1m\]" | |
| OFF="\[\033[m\]" | |
| DARK="\[\033[1;30m\]" | |
| time=`date +"%H:%M"` | |
| branch=`git symbolic-ref HEAD 2> /dev/null | cut -f3 -d/` | |
| if [ ! -z ${branch} ]; then | |
| if [ ${branch} == "master" ]; then | |
| branch=`echo " ${REDBG} ${branch} ${BLACKBG}"` | |
| else | |
| branch=`echo " ${CYAN}${branch}"` | |
| fi | |
| fi | |
| changes=`git status -s 2> /dev/null | \ | |
| wc -l | sed -e 's/ *//'` | |
| if [ ${changes} -eq 0 ]; then | |
| dirty="" | |
| else | |
| dirty="${RED}*${OFF}" | |
| fi | |
| ### Add Heart Prompt | |
| prompt="${GREEN}♥ ${DARK}${time} \ | |
| \w${OFF}${BOLD}${branch}${OFF}${dirty}" | |
| if [ ${exitstatus} -eq 0 ]; then | |
| PS1="${prompt} ${GREEN}\\$ ${OFF}" | |
| else | |
| PS1="${prompt} ${RED}\\$ ${OFF}" | |
| fi | |
| PS2="${BOLD}>${OFF} " | |
| } | |
| PROMPT_COMMAND=prompt_command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment