dotfiles/bash-files/bashrc

81 lines
2.4 KiB
Bash
Raw Normal View History

2012-08-15 00:33:15 -04:00
# 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_dirty() {
[[ $(git-status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "(*)"
2012-08-15 00:33:15 -04:00
}
parse_git_stash() {
[[ $(git stash list 2> /dev/null | tail -n1) != "" ]] && echo "(^)"
2012-08-15 00:33:15 -04:00
}
parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
2012-08-15 00:33:15 -04:00
}
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
2012-08-15 01:10:45 -04:00
alias grep='grep --color'
alias fgrep='fgrep --color'
alias egrep='egrep --color'
2012-08-15 00:33:15 -04:00
alias vim='~/local/bin/vim'
2012-08-15 00:33:15 -04:00
function ll(){ ls -lhF --color=auto "$@"| egrep "^d" ; ls -lXB "$@" 2>&-| \
2012-08-15 00:33:15 -04:00
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
2012-08-15 00:33:15 -04:00
alias tree='tree -Csu' # nice alternative to 'recursive ls'
alias mkdir='mkdir -p'
# aliases
alias cd..="cd .."
alias lp="ls -p --color=auto"
2012-08-15 00:33:15 -04:00
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
2012-08-15 01:10:45 -04:00
if [ -f /opt/local/etc/bash_completion.d/git ]; then
source /opt/local/etc/bash_completion.d/git
2012-08-15 00:33:15 -04:00
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_git_branch) \$(parse_git_dirty)\$(parse_git_stash) } $BLACK]
2012-08-15 00:33:15 -04:00
> "