Skip to content

Instantly share code, notes, and snippets.

@dclelland
Last active December 17, 2015 05:46
Show Gist options
  • Save dclelland/df12fdf9ea200bfd22b7 to your computer and use it in GitHub Desktop.
Save dclelland/df12fdf9ea200bfd22b7 to your computer and use it in GitHub Desktop.
.bash_profile
######################
# ENVIRONMENT CONFIG #
######################
# Custom prompt
GIT_PS1_SHOWDIRTYSTATE=1
PS1='\[\e[00;34m\]\u:\[\e[00m\] \[\e[00;33m\]\w \$\[\e[00m\]$(__git_ps1 " \[\e[00;35m\](%s)\[\e[00m\]")\[\033[00m\] '
PS2='\[\e[00;33m\]> \[\e[00m\]'
# Custom paths
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# Set block size to one kilobyte
export BLOCKSIZE=1k
# Set terminal colours
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
###########
# ALIASES #
###########
# Bash behaviour changes
alias cp='cp -iv'
alias mv='mv -iv'
alias mkdir='mkdir -pv'
# Bash utilities
alias f='open .'
alias s='subl .'
alias a='atom .'
alias x='open *.xcworkspace'
alias ip='ipconfig getifaddr en1'
# Shortcuts
alias ~='cd ~'
alias ..='cd ../'
alias ...='cd ../../'
alias ....='cd ../../../'
alias d='cd ~/Desktop'
alias pn='cd ~/Code/Protonome'
alias br='cd ~/Code/Neighbrhood'
alias stq='cd ~/Code/STQRY'
# Bundler
alias be='bundle exec'
alias bi='bundle install'
alias bu='bundle update'
alias ber='bundle exec rake'
alias bers='bundle exec rails server'
alias berc='bundle exec rails console'
alias bems='bundle exec middleman server'
alias bemb='bundle exec middleman build'
alias bemd='bundle exec middleman deploy'
alias bems3='bundle exec middleman s3_sync'
# Directory listings
alias la='ls -A'
alias ll='ls -FGlAhp'
alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'' | less'
# Git
alias gs='git status'
alias gb='git branch'
alias gbr='git branch -r'
alias gc='git checkout'
alias gm='git merge'
alias gac='git add --all; git commit -a'
alias gsh='git stash'
alias gshp='git stash pop'
alias gd='git --no-pager diff'
alias gdcsv='git --no-pager diff --unified=0 --word-diff-regex="[^,\n]+[,\n]"'
alias gl='git log -8 --pretty=format:"%H %an %s"'
alias glg='git log --graph --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"'
alias gps='git push'
alias gpl='git pull'
alias gf='git fetch'
alias gt='git tag'
# Rails
alias rs='rails server'
alias rc='rails console'
# Cocoapods
alias pi='pod install'
alias pu='pod update'
#########
# OTHER #
#########
# Git autocompletion script
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Git prompt script
if [ -f ~/.git-prompt.sh ]; then
. ~/.git-prompt.sh
fi
# List directories upon change
cd () { builtin cd "$@"; ls; }
# Recursively delete .DS_Store files
alias dsnuke="find . -type f -name '*.DS_Store' -ls -delete"
# Rbenv path
export PATH="$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment