Skip to content

Instantly share code, notes, and snippets.

@abeland
Last active September 5, 2017 14:53
Show Gist options
  • Save abeland/04529fcc239d1e5308695a97897510cb to your computer and use it in GitHub Desktop.
Save abeland/04529fcc239d1e5308695a97897510cb to your computer and use it in GitHub Desktop.
My bash profile (changes often)
export EDITOR='emacs'
# meta
alias eb='emacs ~/.bash_profile'
alias sb='source ~/.bash_profile'
# nav
alias ..='cd ..'
alias ~='cd ~'
alias ls='ls -G'
alias ll='ls -al'
alias clean='rm *~'
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\eOA": history-search-backward'
bind '"\eOB": history-search-forward'
alias e='emacs'
alias ee='emacs ~/.emacs'
function gb {
git fetch origin; git checkout -b $1 origin/master
}
# generic
alias l='less'
alias m='more'
function jk {
kill %$1
}
function be {
bundle exec $@
}
function rt {
be rspec $1
}
function rg {
be rails generate $@
}
alias bi='bundle install'
# git
alias gc='git commit -a'
alias ga='git commit -a --amend'
alias gup='git rebase -i'
alias grc='git rebase --continue'
alias gra='git rebase --abort'
alias gs='git show'
alias gbr='git branch -a'
alias gfo='git fetch origin'
alias gri='git fetch origin; git rebase -i origin/master'
alias grr='git fetch origin; git pull --rebase'
alias gdrop='git stash && git stash drop'
# rails
alias srcrailsenv='source ~/.rails_env.sh'
alias rs='srcrailsenv && bundle exec rails s -b 0.0.0.0'
alias rc='srcrailsenv && bundle exec rails c'
alias rdp='be rails db -p'
alias migrate='be rake db:migrate'
alias rollback='be rake db:rollback'
alias wp='yarn install && yarn run webpack-watch'
# npm
alias yy='yarn install && yarn start'
function rtt {
srcrailsenv && bundle exec rake db:test:prepare && bundle exec rspec $1
}
# Android
export ANDROID_HOME='/Users/abe/Library/Android/sdk'
# Fancy prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/'
}
git_dirty() {
[[ $(git status --porcelain 2>/dev/null | head -1) != "" ]] && echo "*"
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\$(git_dirty)\[\033[00m\] > "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment