dotfiles/.bashrc
2015-02-13 09:40:54 +00:00

76 lines
3.4 KiB
Bash

#--------------------------------------------------------------------------------
# The best editor
#--------------------------------------------------------------------------------
export EDITOR=vim
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# Make less use visual bell
#--------------------------------------------------------------------------------
export LESS="-qr"
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# Update the path with local overrides
#--------------------------------------------------------------------------------
export PATH=/usr/local/bin:/usr/local/sbin:${PATH}
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# A useful prompt
#--------------------------------------------------------------------------------
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ <\1>/'
}
export PS1="[\u@\h \W \$(parse_git_branch)]\\$ "
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# Record history for longer and more dynamically
#--------------------------------------------------------------------------------
# Large history buffer
export HISTSIZE=9999
export HISTFILESIZE=9999
# Avoid duplicates in the history...
export HISTCONTROL=ignoredups:erasedups
# Append history entries...
shopt -s histappend
# After each command, save and reload history
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# OS X aliases
#--------------------------------------------------------------------------------
if [ $(uname -s) = "Darwin" ]; then
alias top='top -u'
alias ll='ls -l'
fi
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# Git aliases
#--------------------------------------------------------------------------------
alias githistory='git log --oneline --abbrev-commit --all --graph --decorate'
alias gitx='open -a GitX .'
alias gitprune='git remote prune origin'
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# Set up GOPATH for Go development
#--------------------------------------------------------------------------------
export GOPATH=${HOME}/src/go
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# Add bash completion scripts
#--------------------------------------------------------------------------------
for FILE in ~/.bash/auto_complete.d/*; do source ${FILE}; done
#--------------------------------------------------------------------------------
[ -f ~/.bashrc_local ] && source ~/.bashrc_local