Skip to content

Instantly share code, notes, and snippets.

@jokerr
Created November 11, 2016 04:12
Show Gist options
  • Save jokerr/578d2df8a77284b5af278afabf57892d to your computer and use it in GitHub Desktop.
Save jokerr/578d2df8a77284b5af278afabf57892d to your computer and use it in GitHub Desktop.
Configuration files for Mac OSX
#Put HomeBrew stuff before system path
PATH=/usr/local/bin:$PATH
export PATH
# set java home to a particular version
#export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
# homebrew: Scala IDEA support
SCALA_HOME=/usr/local/opt/scala/idea
# homebrew: Maven settings
export M2=`brew --prefix maven`/libexec/bin
export M2_HOME=`brew --prefix maven`/libexec
# enable color schemes
export CLICOLOR=1
# bash completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# git status prompts
COLOR_RED="\033[0;31m"
COLOR_YELLOW="\033[0;33m"
COLOR_GREEN="\033[0;32m"
COLOR_OCHRE="\033[38;5;95m"
COLOR_BLUE="\033[0;34m"
COLOR_WHITE="\033[0;37m"
COLOR_RESET="\033[0m"
function git_color {
local git_status="$(git status 2> /dev/null)"
if [[ $git_status =~ "working directory clean" ]]; then
echo -e $COLOR_RED
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
echo -e $COLOR_YELLOW
elif [[ $git_status =~ "nothing to commit" ]]; then
echo -e $COLOR_GREEN
else
echo -e $COLOR_OCHRE
fi
}
function git_branch {
local git_status="$(git status 2> /dev/null)"
local on_branch="On branch ([^${IFS}]*)"
local on_commit="HEAD detached at ([^${IFS}]*)"
if [[ $git_status =~ $on_branch ]]; then
local branch=${BASH_REMATCH[1]}
echo "($branch)"
elif [[ $git_status =~ $on_commit ]]; then
local commit=${BASH_REMATCH[1]}
echo "($commit)"
fi
}
export PS1="\[$COLOR_WHITE\]\h:\W \u\[\$(git_color)\]\$(git_branch)\[$COLOR_BLUE\]\$\[$COLOR_RESET\] "
#usual settings here
# nice colors for git status
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment