Skip to content

Instantly share code, notes, and snippets.

@selvakn
Created April 7, 2010 05:18
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 selvakn/358558 to your computer and use it in GitHub Desktop.
Save selvakn/358558 to your computer and use it in GitHub Desktop.
My bashrc
source ~/.git-completion.bash
export PATH=/Users/selva/.cabal/bin/:/opt/local/bin:/opt/local/sbin:$PATH
export PATH=/usr/local/mysql/bin/:$PATH
if [[ -s /Users/selva/.rvm/scripts/rvm ]] ; then source /Users/selva/.rvm/scripts/rvm ; fi
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PS_COLOR="0;32"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "⚡"
}
export PS1="\n\[\e[${PS_COLOR}m\]\t \u@\H:\w \n\[\e[0;39m\]\$(parse_git_branch)\$(parse_git_dirty)$ "
alias 186='rvm use 1.8.6-p369 --default'
alias 187='rvm use 1.8.7-p249 --default'
alias 191='rvm use 1.9.1-p378 --default'
alias jruby='rvm use jruby --default'
alias ree='rvm use ree --default'
## autojump
_autojump()
{
local cur
COMPREPLY=()
unset COMP_WORDS[0] #remove "j" from the array
cur=${COMP_WORDS[*]}
IFS=$'\n' read -d '' -a COMPREPLY < <(autojump --bash --completion "$cur")
return 0
}
complete -F _autojump j
AUTOJUMP='{ (autojump -a "$(pwd -P)"&)>/dev/null 2>>${HOME}/.autojump_errors;} 2>/dev/null'
if [[ ! $PROMPT_COMMAND =~ autojump ]]; then
export PROMPT_COMMAND="${PROMPT_COMMAND:-:} && $AUTOJUMP"
fi
alias jumpstat="autojump --stat"
function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; cd "$new_path";fi }
## autojump
## Disable spotlight indexing
# sudo mdutil -a -i off
## Disable spotlight indexing
@emaillenin
Copy link

"nothing to commit (working directory clean)" now looks like this "nothing to commit, working directory clean" in the newer git version. so a generic script will do:

parse_git_dirty() {
    git status 2> /dev/null | tail -n1 | grep -v "working directory clean" > /dev/null && echo ""
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment