Last active
October 8, 2015 17:49
-
-
Save jacobhenke/cdc6b217a9edb1723936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mac OSX | |
# | |
# Sublime | |
export EDITOR="subl -w" | |
# Colorful BASH in OSX | |
# http://stackoverflow.com/questions/1550288/mac-os-x-terminal-colors | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then | |
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash | |
fi | |
# SHORTCUTS! | |
alias +='pushd' | |
alias ls='ls -G' | |
alias la='ls -a' # show hidden files | |
alias lal="ls -Gla" # List all files colorized in long format, including dot files | |
# alias lsd='ls -l | grep "^d"' # List only directories | |
alias gs='git status' | |
alias gitlog='git log --graph --date-order -C -M --pretty=format:"%C(yellow)%h%C(reset) - %C(bold green)%ad%C(reset) - %C(dim yellow)%an%C(reset) %C(bold red)>%C(reset) %C(white)%s%C(reset) %C(bold red)%d%C(reset) " --abbrev-commit --date=short' | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
alias diodev='cd ~/projects/code/dio-dev' | |
alias sub="subl" | |
alias profile="sub ~/.bash_profile" | |
alias sbp="source ~/.bash_profile" | |
alias gp='git push' | |
alias gpo='git push origin' | |
# alias gph='git push heroku' | |
alias ip="dig +short myip.opendns.com @resolver1.opendns.com" | |
alias localip0="ipconfig getifaddr en0" | |
alias localip="ipconfig getifaddr en1" | |
alias rm='rm -iv' | |
alias cp='cp -iv' | |
alias mv='mv -iv' | |
# -> Prevents accidentally clobbering files. | |
alias mkdir='mkdir -p' | |
alias h='history' | |
alias j='jobs -l' | |
alias show="defaults write com.apple.Finder AppleShowAllFiles -bool true && killall Finder" | |
alias hide="defaults write com.apple.Finder AppleShowAllFiles -bool false && killall Finder" | |
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/ | |
alias stfu="osascript -e 'set volume output muted true'" | |
alias pumpitup="osascript -e 'set volume 10'" | |
function gitmd() | |
{ | |
echo `git status --porcelain | sed -ne 's/^ M //p' | tr '\n' '\0' | tr -d '"' | xargs -0 sub` | |
} | |
function extract() # Handy Extract Program. | |
{ | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xvf $1 ;; | |
*.tbz2) tar xvjf $1 ;; | |
*.tgz) tar xvzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1 ;; | |
*.7z) 7z x $1 ;; | |
*) echo "'$1' cannot be extracted via >extract<" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh | |
export GIT_PS1_SHOWDIRTYSTATE=true | |
export GIT_PS1_SHOWSTASHSTATE=true | |
export GIT_PS1_SHOWUNTRACKEDFILES=true | |
export GIT_PS1_SHOWUPSTREAM="auto" | |
export GIT_PS1_HIDE_IF_PWD_IGNORED=true | |
export GIT_PS1_SHORTER='$(__git_ps1 | awk '"'"'{print "..." substr($0,length-20,20)}'"'"')' | |
export SHORTLOC='$(echo -n "${PWD/#$HOME/~}" | awk -F "/" '"'"'{ | |
if (substr($0,1,1) == "~") { if (NF>4) print ".../" $(NF-2) "/" $(NF-1) "/" $NF; | |
else if (NF>3) print "~/" $(NF-2) "/" $(NF-1) "/" $NF; | |
else if (NF>2) print "~/" $(NF-1) "/" $NF; | |
else if (NF>1) print "~/" $NF; | |
else print $NF;} | |
else print $0;}'"'"')' | |
TIME='\033[02;36m\][ \033[01;31m\]\A \033[01;32m\]' | |
HOST=' \033[02;36m\]\h' #; HOST=' '$HOST | |
LOCATION=' \033[01;34m\]$(eval "echo ${SHORTLOC}") ' | |
# BRANCH='\033[00;33m\]$(eval "echo ${GIT_PS1_SHORTER}")\[\033[00m\] \033[02;36m\]]\n\e[0m>' | |
BRANCH='\033[00;33m\]$(__git_ps1)\[\033[00m\] \033[02;36m\]]\n\e[0m>' | |
PS1=$TIME$USER$HOST$LOCATION$BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment