jparker / dotfiles

Home directory content (config files for shells, editors, tools, etc.)

This URL has Read+Write access

dotfiles / .bashrc
100644 39 lines (32 sloc) 0.965 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
if [ -d /opt/local/bin ]; then
  PATH="$PATH:/opt/local/bin:/opt/local/sbin"
fi
if [ -d /opt/local/lib/postgresql83/bin ]; then
  PATH="$PATH:/opt/local/lib/postgresql83/bin"
fi
 
if [ -d /usr/local/ImageMagick/bin ]; then
  PATH="$PATH:/usr/local/ImageMagick/bin"
fi
 
if [ -d /opt/ruby-enterprise/bin ]; then
  PATH="/opt/ruby-enterprise/bin:$PATH"
fi
 
if uname -s | grep -q Darwin; then
  top ()
  {
    if [ $# -gt 0 ]; then
      /usr/bin/top "$@"
    else
      /usr/bin/top -o cpu -s 5
    fi
  }
fi
 
function git_current_branch {
  local branch=$(git branch 2>/dev/null | grep '^*' | cut -d' ' -f2-)
  [[ $branch ]] && echo "[$branch$(git_needs_push)$(git_branch_dirty)]"
}
 
function git_branch_dirty {
  [[ $(git status 2>/dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo -e "\033[01;33m*\033[00m"
}
 
function git_needs_push {
  git status 2>/dev/null | egrep -q 'is ahead|have diverged' && echo -e "\033[01;31m!\033[00m"
}