dotfiles/bash-files/bashrc
2014-03-19 09:39:37 -07:00

81 lines
2.5 KiB
Bash

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
parse_git_branch () {
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#'
}
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk '{print " (svn::"$1")" }'
}
parse_svn_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
parse_svn_repository_root() {
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
}
BLACK="\[\033[0;38m\]"
RED="\[\033[0;31m\]"
RED_BOLD="\[\033[01;31m\]"
BLUE="\[\033[01;34m\]"
GREEN="\[\033[0;32m\]"
export CLICOLOR=1
export EDITOR=/usr/bin/mvim
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
fi
alias grep='grep --color'
alias fgrep='fgrep --color'
alias egrep='egrep --color'
alias vim='~/local/bin/vim'
function ll(){ ls -lhF --color=auto "$@"| egrep "^d" ; ls -lXB "$@" 2>&-| \
egrep -v "^d|total "; }
alias ls="ls -hF --color=auto"
alias la='ls -Al --color=auto' # show hidden files
alias lx='ls -lXB --color=auto' # sort by extension
alias lk='ls -lSr --color=auto' # sort by size, biggest last
alias lc='ls -ltcr --color=auto' # sort by and show change time, most recent last
alias lu='ls -ltur --color=auto' # sort by and show access time, most recent last
alias lt='ls -ltr --color=auto' # sort by date, most recent last
alias lm='ls -al --color=auto | more' # pipe through 'more'
alias lr='ls -lR --color=auto' # recursive ls
alias tree='tree -Csu' # nice alternative to 'recursive ls'
alias mkdir='mkdir -p'
# aliases
alias cd..="cd .."
alias lp="ls -p --color=auto"
alias h=history
# the "kp" alias ("que pasa"), in honor of tony p.
alias kp="ps auxwww"
# general path munging
PATH=${PATH}:~/bin
PATH=${PATH}:/usr/local/bin
if [ -f /opt/local/etc/bash_completion.d/git ]; then
source /opt/local/etc/bash_completion.d/git
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUPSTREAM=auto
fi
# configure my multi-line prompt
export PS1="
$BLACK[ \u@$RED\h $GREEN\w$RED_BOLD\$(parse_svn_branch)\$(__git_ps1 \" (%s)\") $BLACK]
> "