Last active
August 29, 2015 14:01
-
-
Save nicwolff/62363795f34e9ed022b8 to your computer and use it in GitHub Desktop.
Bash configuration
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
| # .bash_profile | |
| # Get the aliases and functions | |
| if [ -f ~/.bashrc ]; then | |
| . ~/.bashrc | |
| fi | |
| # User specific environment and startup programs | |
| bind '"\e[A":history-search-backward' | |
| bind '"\e[B":history-search-forward' | |
| export PATH=$PATH:$HOME/bin | |
| if [ -f ~/.git-completion.bash ]; then | |
| . ~/.git-completion.bash | |
| fi | |
| BLUE='\[\e[01;34m\]' | |
| WHITE='\[\e[01;37m\]' | |
| RED='\[\e[01;31m\]' | |
| GREEN='\[\e[01;32m\]' | |
| YELLOW='\[\e[01;33m\]' | |
| RESET='\[\e[00m\]' | |
| set_prompt () { | |
| local last=$? | |
| local color=$GREEN | |
| if [[ $last != 0 ]]; then | |
| color=$RED | |
| fi | |
| PS1="$RESET\n$color\u@\h: $YELLOW\w$RESET" | |
| if ref=$(git symbolic-ref HEAD 2> /dev/null) | |
| then | |
| PS1+=" (${ref#refs/heads/}" | |
| if ! git status | grep 'nothing to commit' > /dev/null | |
| then | |
| PS1+=" $RED✗" | |
| fi | |
| PS1+="$RESET)" | |
| fi | |
| PS1+="\n➔ " | |
| } | |
| PROMPT_COMMAND=set_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment