Skip to content

Instantly share code, notes, and snippets.

@maxmarchuk
Last active May 31, 2016 22:50
Show Gist options
  • Save maxmarchuk/9e758ee0994a7c2977a0 to your computer and use it in GitHub Desktop.
Save maxmarchuk/9e758ee0994a7c2977a0 to your computer and use it in GitHub Desktop.
My very messy bash profile
source ~/.bash_aliases
source ~/.git-prompt.sh
export PS1="\[\e[00;36m\]\u\[\e[0m\]\[\e[00;37m\]@\[\e[0m\]\[\e[00;36m\]\h\[\e[0m\]\[\e[00;37m\]:\[\e[0m\]\[\e[00;35m\]\w\[\e[0m\]\[\e[00;37m\]> \[\e[0m\]"
#Get the current VCS branch name (git, mercurial, svn)
function be_get_branch {
local dir="$PWD"
local vcs
local nick
while [[ "$dir" != "/" ]]; do
for vcs in git hg svn bzr; do
if [[ -d "$dir/.$vcs" ]] && hash "$vcs" &>/dev/null; then
case "$vcs" in
git) __git_ps1 "${1:-(%s) }"; return;;
hg) nick=$(hg branch 2>/dev/null);;
svn) nick=$(svn info 2>/dev/null\
| grep -e '^Repository Root:'\
| sed -e 's#.*/##');;
bzr)
local conf="${dir}/.bzr/branch/branch.conf" # normal branch
[[ -f "$conf" ]] && nick=$(grep -E '^nickname =' "$conf" | cut -d' ' -f 3)
conf="${dir}/.bzr/branch/location" # colo/lightweight branch
[[ -z "$nick" ]] && [[ -f "$conf" ]] && nick="$(basename "$(< $conf)")"
[[ -z "$nick" ]] && nick="$(basename "$(readlink -f "$dir")")";;
esac
[[ -n "$nick" ]] && printf "${1:-(%s) }" "$nick"
return 0
fi
done
dir="$(dirname "$dir")"
done
}
## Add branch to PS1 (based on $PS1 or $1), formatted as $2
export GIT_PS1_SHOWDIRTYSTATE=yes
export PS1="\$(be_get_branch "$2")${PS1}";
# Eternal bash history.
# ---------------------
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Ignore duplicate history entries
export HISTCONTROL=ignoreboth:erasedups
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
#export MAVEN_HOME="/usr/local/Cellar/maven/3.3.3/libexec/bin"
#export MAVEN_REPOSITORY="/Users/max.marchuk/.m2/repository"
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
export M3_HOME="/usr/local/Cellar/maven/3.3.9/libexec"
eval "$(docker-machine env jama)"
export NVM_DIR=~/.nvm
. $(brew --prefix nvm)/nvm.sh
ulimit -n 65536 65536
set rnu
export PATH=$PATH:/usr/local/bin
export PATH=$PATH:/usr/local/Cellar/maven/3.3.9/bin
export PATH=$PATH:/Users/mmarchuk/Library/Android/sdk/platform-tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment