Skip to content

Instantly share code, notes, and snippets.

@jimmynguyc
Created August 11, 2014 04:57
Show Gist options
  • Save jimmynguyc/daf2879cd7378dde64c6 to your computer and use it in GitHub Desktop.
Save jimmynguyc/daf2879cd7378dde64c6 to your computer and use it in GitHub Desktop.
.bash_profile
parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo -en "⸕"
}
parse_git_info() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1)$(parse_git_dirty)/"
}
parse_svn_dirty(){
SVN_STATUS="`svn status 2> /dev/null`"
if [ -z "$SVN_STATUS" ]
then
echo ''
else
DIRTY=false
for i in $SVN_STATUS; do
if [ '?' = "${i:0:1}" -o "M" == "${i:0:1}" -o "A" == "${i:0:1}" ]; then
DIRTY=true
fi
done
if [ $DIRTY == true ]; then
echo -en "⸕"
fi
fi
}
parse_svn_info() {
svn info 2> /dev/null | sed -n '6,6p' | awk '{print "Rev:"$2}' | sed -e "s/\(.*\)/ (\1)$(parse_svn_dirty)/"
}
# color code
# \[\e[36m\] (code here) \[\e[0m\]
PS1="\d \t \[\e[1m\]\W\[\e[0m\]\[\e[36m\]\$(parse_git_info)\[\e[0m\]\[\e[36m\]\$(parse_svn_info)\[\e[0m\] \[\e[31m\]🌀 \[\e[0m\]"
export SVN_EDITOR=nano
export EVENT_NOKQUEUE=1
export PATH="/usr/local/bin:$PATH:/usr/local/sbin"
export LANG="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# Ruby Gems
export BUNDLER_EDITOR="subl"
export GEM_OPEN_EDITOR="subl"
export GEM_EDITOR="subl"
# Homebrew
. `brew --prefix`/etc/profile.d/z.sh
# git completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Rbenv
export RBENV_ROOT=/usr/local/var/rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# ssh completion
# ssh config completion
function _ssh_completion() {
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
}
complete -W "$(_ssh_completion)" ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment