Skip to content

Instantly share code, notes, and snippets.

@kapilreddy
Created October 10, 2012 13:18
Show Gist options
  • Save kapilreddy/3865597 to your computer and use it in GitHub Desktop.
Save kapilreddy/3865597 to your computer and use it in GitHub Desktop.
OSX .bash_profile
##
# Prints terminal codes.
#
# Thanks to: http://github.com/wayneeseguin/rvm/blob/master/scripts/color
#
# @param [String] terminal code keyword (usually a color)
bput() {
case "$1" in
# regular colors
black) tput setaf 0 ;;
red) tput setaf 1 ;;
green) tput setaf 2 ;;
yellow) tput setaf 3 ;;
blue) tput setaf 4 ;;
magenta) tput setaf 5 ;;
cyan) tput setaf 6 ;;
white) tput setaf 7 ;;
# emphasized (bolded) colors
eblack) tput bold ; tput setaf 0 ;;
ered) tput bold ; tput setaf 1 ;;
egreen) tput bold ; tput setaf 2 ;;
eyellow) tput bold ; tput setaf 3 ;;
eblue) tput bold ; tput setaf 4 ;;
emagenta) tput bold ; tput setaf 5 ;;
ecyan) tput bold ; tput setaf 6 ;;
ewhite) tput bold ; tput setaf 7 ;;
# underlined colors
ublack) set smul unset rmul ; tput setaf 0 ;;
ured) set smul unset rmul ; tput setaf 1 ;;
ugreen) set smul unset rmul ; tput setaf 2 ;;
uyellow) set smul unset rmul ; tput setaf 3 ;;
ublue) set smul unset rmul ; tput setaf 4 ;;
umagenta) set smul unset rmul ; tput setaf 5 ;;
ucyan) set smul unset rmul ; tput setaf 6 ;;
uwhite) set smul unset rmul ; tput setaf 7 ;;
# background colors
bblack) tput setab 0 ;;
bred) tput setab 1 ;;
bgreen) tput setab 2 ;;
byellow) tput setab 3 ;;
bblue) tput setab 4 ;;
bmagenta) tput setab 5 ;;
bcyan) tput setab 6 ;;
bwhite) tput setab 7 ;;
# Defaults
default) tput setaf 9 ;;
bdefault) tput setab 9 ;;
none) tput sgr0 ;;
*) tput sgr0 # Reset
esac
}
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Emacs for everything!
emacsclient="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient"
export EDITOR="$emacsclient -c"
export CSCOPE_EDITOR="$emacsclient -c"
export VISUAL="$emacsclient -c"
# Common history across all terminals -- abhishek
export HISTCONTROL=ignoredups:ignorespace
export HISTFILE=~/.bash_history
export HISTFILESIZE=5000
export HISTSIZE=5000
shopt -s histappend
export PATH=$PATH:~/.bin
export PATH="$PATH:/usr/local/sbin:"
source ~/.bin//git-prompt.sh
source ~/.bin/git-completion.bash
# Change prompt for git goodness
# PS1='\[\033[01;32m\]\u\[\033[00m\]@\[\033[0;32m\]\h\[\033[00m\]:\[\033[0;34m\]\w\[\033[0m\]$(__git_ps1 " (%s)")\n\$ '
PS1='$(bput white)\u@$(bput white)\h:$(bput cyan)\w$(bput red)$(__git_ps1 " (%s)")$(bput green)\n\$: '
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUPSTREAM="verbose"
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
set -o emacs
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
source /usr/local/bin/virtualenvwrapper.sh
export ANDROID_HOME=/Users/kapil/src/android-sdk-macosx/
export PATH="$PATH:/Users/kapil/src/android-sdk-macosx/tools:/Users/kapil/src/android-sdk-macosx/platform-tools:"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment