diff --git a/gitconfig b/gitconfig index b23c8fe..f12500c 100644 --- a/gitconfig +++ b/gitconfig @@ -28,45 +28,3 @@ frag = magenta old = red new = green -[alias] - b = branch - h = !git head - l = !git ll -25 - p = push - r = reset - s = stash - x = reset --hard - sl = stash list - sp = stash pop - sd = stash drop - sa = stash apply - st = status - ci = commit - cp = cherry-pick - co = checkout - d = diff - dc = diff --cached - ds = diff --staged - dw = diff --color-words - ae = commit --amend - aa = add --all - head = !git l -1 - hp = "!source ~/.githelpers && show_git_head" - re = remote - ra = !git r --all - ff = merge --ff-only - pff = pull --ff-only - noff = merge --no-ff - theirs = merge -Xtheirs - la = !git ll --all - ll = "!source ~/.githelpers && pretty_git_log" - div = divergence - gn = goodness - gnc = goodness --cached - fa = fetch --all - pom = push origin master - ds = diff --stat=160,120 - dh1 = diff HEAD~1 - snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" - ours = "!f() { git checkout --ours $@ && git add $@; }; f" - theirs = "!f() { git checkout --theirs $@ && git add $@; }; f" diff --git a/zsh/aliases b/zsh/aliases index 2213661..37caa2f 100644 --- a/zsh/aliases +++ b/zsh/aliases @@ -1,125 +1,110 @@ # Handle the fact that this file will be used with multiple OSs platform=`uname` if [[ $platform == 'Linux' ]]; then - alias a='ls -lrth --color' + alias l='ls -l --color' + alias ll='ls -lrth --color' elif [[ $platform == 'Darwin' ]]; then - alias a='ls -lrthG' + alias l='ls -laG' + alias ll='ls -lG' fi -alias amend="git commit --amend" -alias asu="cd ~/code/rails/activesupport" +alias c='cd' +alias cd-='cd -' +alias ..='cd ../' +alias ...='cd ../..' +alias cd..='cd ..' +alias cd...='cd ../..' +alias cd....='cd ../../..' +alias cd.....='cd ../../../..' +alias cd/='cd /' +alias ls='ls -G' + alias aliases='vim ~/.dotfiles/zsh/aliases' -alias b='ssh -t ben@benorenstein.com screen -rd irc' alias bake='bundle exec rake' alias be='bundle exec' -alias ben='ssh ben@benorenstein.com' alias bi='bundle install' alias be='bundle exec' -alias bo='cd ~/code/boardwalk' +alias beg='bundle exec guard' alias bu='bundle update' -alias bunbang='bundle install && !!' -alias c='cd' +alias cls=clear alias code='cd ~/code' -alias codereview='vim ~/Dropbox/notes/code-review-checklist.txt' alias d='cd ~/.dotfiles' -alias dbprep='rdm && rdtp' -alias di='cd ~/code/discourse' alias dr='cd ~/Dropbox' -alias drop='cd ~/Dropbox' -alias fs='foreman start' -alias -g G='| grep' -alias gad='git add .' -alias gadu='git add -u .' -alias gbc='gdc' -alias gca='git commit -a' -alias gcaa='git commit -a --amend -C HEAD' +alias duh='du -csh' + +# Git +alias ammend='amend' +alias amend='git commit --amend' +alias gaa='echo "Use ga!" && git add --all' +alias ga='git add --all' +alias gae='echo "Use amend!" && git commit --amend' # Remove when not needed +alias gau='git add --update' +alias gb='git branch' +alias gc='git commit' +alias gci='echo "Use gc!" && git commit' # Remove when no longer needed alias gcl='git clone' alias gcm="git commit -m" alias gco='git checkout' +alias gcp='git cherry-pick' alias gd='git diff' alias gdc='git diff --cached' alias gdm='git diff master' -alias get='sudo apt-get install' -alias gg='git lg' -alias gpush='echo "Use gp!" && git push' +alias gds='git diff --stat=160,120' +alias gdw='git diff --color-words' +alias gf='git fetch' +alias gh="source ~/.githelpers && show_git_head" +alias gl="source ~/.githelpers && pretty_git_log" +alias gll='git ll -25' +alias gla='git ll --all' +alias gmff='git merge -ff-only' +alias gmtheirs='git merge -Xtheirs' alias gp='git push' alias gpf='git push -f' +alias gpff='git pull --ff-only' +alias gpom='git push origin master' alias gpr='git pull --rebase' +alias gr='git reset' alias grc='git rebase --continue' -alias grake='rspec --drb spec/ && cucumber --drb features/' -alias gurad='guard' -alias h='sync' -alias he='cd ~/code/hacker-engine' -alias herkou='heroku' -alias hpush='git push heroku' +alias gre='git remote' +alias gsnapshot='git stash save "snapshot: $(date)" && git stash apply "stash@{0}"' +alias gst='git status' +alias gs='git stash' +alias gsa='git stash apply' +alias gsd='git stash drop' +alias gsl='git stash list' +alias gsp='git stash pop' +alias gx='git reset --hard' + +alias history='fc -l 1' alias irb='irb --readline -r irb/completion' -alias journal='vim ~/Dropbox/docs/journal/2011.txt' -alias killruby='killall -9 ruby' -alias killrudy='killall -9 ruby' -alias -g M='| more' -alias mastre='master' -alias newscreen="screen -S foo" -#alias l='cd ~/code/learn' -alias -g L='| less' -alias pc='production-console' -alias parallel='rdtp && rake parallel:prepare test:parallel_with_specs' alias patch='git format-patch HEAD^ --stdout > patch.diff' -alias podcast='vim ~/Dropbox/work/thoughtbot/notes/podcast.txt' -alias prepdb='dbprep' -alias r='cd ~/code/refactoring-good-to-great' -alias remore='!! | more' alias reguard='killall -9 ruby ; guard' -alias rerake='!! && rake' -alias restart_apache="sudo /etc/init.d/apache2 restart" -alias restart_postgres="stoppostgres && startpostgres" -alias retag='ctags -R --exclude=.svn --exclude=.git --exclude=log --exclude=tmp *' -alias retagwithcoffee='ctags -R --exclude=.svn --exclude=.git --exclude=log --exclude=tmp * && coffeetags -R -f >> tags' -alias repush="gpr && git push" -alias review="git diff master" +alias r='rails' alias rc='rails console' -alias remigrate='rake db:migrate && rake db:migrate:redo && rake db:schema:dump && rake db:test:prepare' -alias rdm="be rake db:migrate" -alias rdtp="be rake db:test:prepare" -alias rs='bundle install && rails server -p 3000' -alias safepush='git pull --rebase && bundle install && rdm && rake && git push' -alias sfh='cd ~/code/speaking-for-hackers-book' -alias shpush='rake && hpush' -alias sc='staging-console' -alias so='source ~/.dotfiles/zsh/aliases' -alias sp='safepush' -alias speaking='cd ~/Dropbox/speaking' -alias ss='ruby app.rb' -alias startpostgres='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start' -alias startredis='redis-server /usr/local/etc/redis.conf &' -alias stoppostgres='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log stop' -alias staging='git push heroku-staging master' -alias sync='git add -u . && git commit -m "Minor changes. Commit message skipped." && repush' +alias reload='source ~/.zshrc' alias tail-logs='heroku logs -t' -alias track='git checkout -t' -alias warmup='vim ~/Dropbox/barbershop/warmups/ideas.txt' -alias worknotes='vim ~/Dropbox/work/thoughtbot/notes' alias u='cd ..' alias v='vim' alias vi='vim' -alias vu='cd ~/code/vim-university' -alias y='cd ~/code/ybuy' -alias z='zeus' -alias zs='zeus start' +alias vimrc='vim ~/.vimrc' +alias zsh='vim ~/.zshrc' + +# Notes +alias todo='vim ~/Dropbox/notes/life-todo' +alias wtodo='vim ~/Dropbox/notes/work-todo' +alias sharp='vim ~/Dropbox/notes/sharpening-notes' + +# Projects +alias projects='cd ~/code/projects' +alias perks='cd ~/code/work/src/campusperks' +alias work='cd ~/code/work' +alias learn='cd ~/code/learning-area' +alias dot='cd ~/code/projects/dotfiles' # Heroku staging -alias staging-console='heroku run console --remote staging' -alias staging-tail='heroku logs --tail --remote staging' +alias staging-console='heroku run console --app campusperks-staging' +alias staging-tail='heroku logs --tail --app campusperks-staging' # Heroku production -alias production-console='heroku run console --remote production' -alias production-tail='heroku logs --tail --remote production' - -# # Heroku databases -alias db-pull-staging='heroku db:pull --remote staging --confirm `basename $PWD`-staging' -alias db-pull-production='heroku db:pull --remote production --confirm `basename $PWD`-production' -alias db-copy-production-to-staging='heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging --confirm `basename $PWD`-staging' -alias db-backup-production='heroku pgbackups:capture --remote production' -alias db-backups='heroku pgbackups --remote production' - -alias levelup-get-production='curl -o ~/Downloads/latest.dump `heroku pgbackups:url --app levelup-production`' -alias levelup-db-fix='killruby ; rake db:drop:all db:create:all ; pg_restore --verbose --clean --no-acl --no-owner -d levelup_development ~/Downloads/latest.dump -j 8 ; prepdb && rake levelup:dev:create_admin && rails runner CreditCard.delete_all' +alias production-console='heroku run console --app campusperks' +alias production-tail='heroku logs --tail --app campusperks' diff --git a/zsh/functions b/zsh/functions index 2e38f07..632ac17 100644 --- a/zsh/functions +++ b/zsh/functions @@ -1,3 +1,11 @@ +function activate_virtualenv() { + if [ -f env/bin/activate ]; then . env/bin/activate; + elif [ -f ../env/bin/activate ]; then . ../env/bin/activate; + elif [ -f ../../env/bin/activate ]; then . ../../env/bin/activate; + elif [ -f ../../../env/bin/activate ]; then . ../../../env/bin/activate; + fi +} + function git-new-remote-tracking { git checkout -b $1 && git push -u origin $1 } diff --git a/zsh/lib/completion.zsh b/zsh/lib/completion.zsh new file mode 100644 index 0000000..b964595 --- /dev/null +++ b/zsh/lib/completion.zsh @@ -0,0 +1,72 @@ +# fixme - the load process here seems a bit bizarre + +unsetopt menu_complete # do not autoselect the first completion entry +unsetopt flowcontrol +setopt auto_menu # show completion menu on succesive tab press +setopt complete_in_word +setopt always_to_end + +WORDCHARS='' + +zmodload -i zsh/complist + +## case-insensitive (all),partial-word and then substring completion +if [ "x$CASE_SENSITIVE" = "xtrue" ]; then + zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + unset CASE_SENSITIVE +else + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' +fi + +zstyle ':completion:*' list-colors '' + +# should this be in keybindings? +bindkey -M menuselect '^o' accept-and-infer-next-history + +zstyle ':completion:*:*:*:*:*' menu select +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' +zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" + +# disable named-directories autocompletion +zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories +cdpath=(.) + +# use /etc/hosts and known_hosts for hostname completion +[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(