Skip to content

Instantly share code, notes, and snippets.

@ouyangzhiping
Created July 11, 2011 15:58
Show Gist options
  • Save ouyangzhiping/1076167 to your computer and use it in GitHub Desktop.
Save ouyangzhiping/1076167 to your computer and use it in GitHub Desktop.
My .bash_login file with git+brew support+textmate
# PATH ------------------------------------------------------------
export PATH="/usr/local/bin:/usr/local/Cellar/ruby/1.9.2-p180/bin/:/usr/local/sbin:~/bin/:$PATH"
# Add Bash Completion ---------------------------------------------
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# Add Bash Completion support for Brew ----------------------------
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
# Git Stuff -------------------------------------------------------
function __git_dirty {
git diff --quiet HEAD &>/dev/null
[ $? == 1 ] && echo "*"
}
source /usr/local/Cellar/git/1.7.5/etc/bash_completion.d/git-completion.bash
export GIT_EDITOR="mate -w"
alias gbl='git branch'
alias gba='git branch -a'
alias gbd='git branch -d'
alias gco='git checkout'
alias gcb='git checkout -b'
alias gci='git commit -v'
alias gdf='git diff | mate'
alias gpl='git pull'
alias gps='git push'
alias gsl='git stash list'
alias gsp='git stash pop'
alias gss='git stash save'
alias gst='git status'
# Colors ----------------------------------------------------------
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
alias ls='ls -G'
export COLOR_NC='\e[0m'
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
export COLOR_BLUE='\e[0;34m'
export COLOR_LIGHT_BLUE='\e[1;34m'
export COLOR_GREEN='\e[0;32m'
export COLOR_LIGHT_GREEN='\e[1;32m'
export COLOR_CYAN='\e[0;36m'
export COLOR_LIGHT_CYAN='\e[1;36m'
export COLOR_RED='\e[0;31m'
export COLOR_LIGHT_RED='\e[1;31m'
export COLOR_PURPLE='\e[0;35m'
export COLOR_LIGHT_PURPLE='\e[1;35m'
export COLOR_BROWN='\e[0;33m'
export COLOR_YELLOW='\e[1;33m'
export COLOR_GRAY='\e[1;30m'
export COLOR_LIGHT_GRAY='\e[0;37m'
alias colorslist="set | egrep 'COLOR_\w*'"
# Hello Messsage --------------------------------------------------
echo -e "Kernel Information: " `uname -smr`
echo -e "\033[0;33m`bash --version`"
echo -ne "\033[1;30mUptime: "; uptime
echo -ne "\033[1;30mServer time is: "; date
# Misc -------------------------------------------------------------
export HISTCONTROL=ignoredups
shopt -s checkwinsize
bind "set completion-ignore-case on"
bind "set bell-style none"
bind "set show-all-if-ambiguous On"
# Color Prompt ----------------------------------------------------
export PS1='\w `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\[\033[37m\]$\[\033[00m\] '
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[0;37m\][\t\[\033[0;37m\]]\[\033[0;33m\][\[\033[1;36m\]\u\[\033[1;36m\]@\[\033[1;36m\]\h \[\033[1;31m\]\w\[\033[0;33m\]]\[\033[1;31m\] $(__git_ps1 "(%s)")\[\033[0;37m\]\\$ \[\033[00m\]'
else
PS1='\[\033[0;37m\][\t\[\033[0;37m\]]\[\033[0;33m\][\[\033[1;36m\]\u\[\033[1;36m\]@\[\033[1;36m\]\h \[\033[1;32m\]\w\[\033[0;33m\]]\[\033[1;31m\] $(__git_ps1 "(%s)")\[\033[0;37m\]\\$ \[\033[00m\]'
fi
# Navigation -------------------------------------------------------
alias ..='cd ..'
alias ...='cd .. ; cd ..'
if [ ! -f ~/.dirs ]; then # if doesn't exist, create it
touch ~/.dirs
fi
alias show='cat ~/.dirs'
save () {
command sed "/!$/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ;
}
source ~/.dirs
shopt -s cdable_vars
# Other aliases ----------------------------------------------------
alias l='ls'
alias ll='ls -hl'
alias la='ls -a'
alias lla='ls -lah'
alias g='grep -i'
alias f='find . -iname'
alias ducks='du -cksh * | sort -rn|head -11'
alias top='top -o cpu'
alias systail='tail -f /var/log/system.log'
alias m='more'
alias df='df -h'
alias pgstart='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias pgstop='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr"
# Editors ----------------------------------------------------------
export EDITOR='mate -w'
export EDITOR="mate -w"
export VISUAL="mate -w"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment