Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@waja
Last active December 24, 2015 07:28
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 waja/6763597 to your computer and use it in GitHub Desktop.
Save waja/6763597 to your computer and use it in GitHub Desktop.
Color your (Bash-)Life
if [ "$TERM" != "dumb" ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
# For ls colors in Solarized theme
# https://github.com/seebi/dircolors-solarized/issues/10
export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD
# source git completion
if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
fi
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
alias ls='ls -G'
else
eval "`dircolors -b`"
alias ls='ls --color=auto'
fi
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=32
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=34
else
local ansi=33
fi
echo -n '\[\e[0;33;'"$ansi"'m\]'"$(__git_ps1)"'\[\e[0m\]'
fi
}
function _prompt_command() {
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;38m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]`_git_prompt`\$ "
}
PROMPT_COMMAND=_prompt_command
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment