-
-
Save courtneyfaulkner/235332 to your computer and use it in GitHub Desktop.
Show Git dirty status in your Unix bash prompt, show ls color, simple tree
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
| #!/bin/sh | |
| source /usr/local/etc/bash_completion.d/git-completion.bash | |
| source /usr/local/etc/bash_completion.d/git-flow-completion.bash | |
| source /usr/local/etc/bash_completion.d/git-prompt.sh | |
| export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256" | |
| export CLICOLOR=1 | |
| BLACK="\[\033[0;0m\]" | |
| BLUE="\[\033[0;34m\]" | |
| BROWN="\[\033[0;33m\]" | |
| COLOR_NONE="\[\e[0m\]" | |
| CYAN="\[\033[0;36m\]" | |
| GREEN="\[\033[0;32m\]" | |
| LIGHT_GRAY="\[\033[1;37m\]" | |
| LIGHT_GREEN="\[\033[1;32m\]" | |
| LIGHT_RED="\[\033[1;31m\]" | |
| PURPLE="\[\033[0;35m\]" | |
| RED="\[\033[0;31m\]" | |
| WHITE="\[\033[0;37m\]" | |
| YELLOW="\[\033[0;33m\]" | |
| function tree { | |
| find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' | |
| } | |
| GIT_PS1_SHOWDIRTYSTATE=1 | |
| GIT_PS1_SHOWSTASHSTATE=1 | |
| GIT_PS1_SHOWUNTRACKEDFILES=1 | |
| #GIT_PS1_SHOWUPSTREAM="auto" | |
| function prompt_func() { | |
| previous_return_value=$?; | |
| TITLEBAR='\[\e]2;\w\a\]' | |
| prompt="${TITLEBAR}${PURPLE}\u@\h ${BLUE}\W${GREEN}$(__git_ps1)${COLOR_NONE} " | |
| if test $previous_return_value -eq 0 | |
| then | |
| PS1="${prompt}\$ " | |
| else | |
| PS1="${prompt}${RED}\$${COLOR_NONE} " | |
| fi | |
| } | |
| PROMPT_COMMAND=prompt_func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OS X
Create/add/replace your
~/.bash_profilewith the contents from above. The/usr/local/etc/bash_completion.d/git-completion.bashscript is installed withgitwhen you installgitwithbrew(http://mxcl.github.com/homebrew/).Linux
Using the above in your
~/.bash_profileshould work, but you'll need to install thegit-completion.bashscript from https://github.com/git/git/blob/master/contrib/completion/git-completion.bash.Windows
I haven't tested it, but following the Linux instructions in Cygwin should/might work.