casualjim
10/24/2012 - 9:52 PM

bashrc.sh

PROMPT_COMMAND='history -a'
PATH=/usr/local/sbin:$PATH

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# Make Bash append rather than overwrite the history on disk
shopt -s histappend

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"


# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_colored_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  # We have color support; assume it's compliant with Ecma-48
  # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  # a case would tend to support setf rather than setaf.)
  color_prompt=yes
    else
  color_prompt=
    fi
fi

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}


export PS1='\e[0;32m+ \u @ \w\e[m\e[0;33m »\e[m '
if [ "$color_prompt" = yes ]; then
 PS1="\[\033[01;36m\]+\u@\h\[\033[00m\]:\[\033[01;32m\]\w\[\033[00m\]\[\033[01;33m\]\n\$(parse_git_branch)»\[\033[00m\] "
else
  PS1='\u@\h:\w\$ '
fi

# If this is an xterm set the title to user@host:dir
# case "$TERM" in
# xterm*|rxvt*)
#     PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
#     ;;
# *)
#     ;;
# esac

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
   . ~/.bash_aliases
fi

# enable completion for rake commands and setup cloudslide env
#if [ -f $HOME/projects/cloudslide/config/devenv ]; then
#  . $HOME/projects/cloudslide/config/devenv
#fi

# enable color support of ls and also add handy aliases

if [ -x /usr/local/bin/gdircolors ]; then
    [ -e "$HOME/.dir_colors" ] && DIR_COLORS="$HOME/.dir_colors"
    [ -e "$DIR_COLORS" ] || DIR_COLORS=""
    eval "`gdircolors -b $DIR_COLORS`"
    alias ls='gls --color=auto'
    alias dir='gls --color=auto --format=vertical'
    alias vdir='gls --color=auto --format=long'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -lh'
alias la='ls -A'
alias l='ls -CF'
alias free="free -m"
alias apache_logs='cd /private/var/log/apache2/'
alias vhosts='subl -w /Users/ivan/projects/vhosts.conf'
alias hosts='subl -w /etc/hosts'
alias restart_apache='sudo /usr/local/apache2/bin/apachectl restart'
alias show_hidden_files="defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder"
alias hide_hidden_files="defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder"
alias incognito_firefox="/Applications/Firefox.app/Contents/MacOS/firefox -P Incognito &" 


# Setting PATH for MacPython 2.6
# The orginal version is saved in .profile.pysave
#PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
export PATH
export LC_ALL=en_US.UTF-8 
export LANG=en_US.UTF-8

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /usr/local/Library/Contributions/brew_bash_completion.sh ]; then
    . /usr/local/Library/Contributions/brew_bash_completion.sh       
fi

# enable completion for git commands
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
  . /usr/local/git/contrib/completion/git-completion.bash
fi 

# enable completion for git flow commands
if [ -f /usr/local/Cellar/git-flow/0.4.1/etc/bash_completion.d/git-flow-completion.bash ]; then
  . /usr/local/Cellar/git-flow/0.4.1/etc/bash_completion.d/git-flow-completion.bash
fi

if [[ -s /Users/ivan/.rvm/scripts/rvm ]] ; then source /Users/ivan/.rvm/scripts/rvm ; fi