Created
July 24, 2008 18:08
-
-
Save technoweenie/2235 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
# access these directory shortcuts | |
# with ~rails, ~beast, etc | |
p=~/p | |
w=~/w | |
rails=~/p/rails/git | |
todo=~/Documents/todo | |
# Input stuff. | |
bindkey -e | |
# History stuff. | |
setopt HIST_VERIFY | |
setopt INC_APPEND_HISTORY | |
setopt SHARE_HISTORY | |
setopt EXTENDED_HISTORY | |
setopt HIST_IGNORE_DUPS | |
HISTSIZE=256 | |
SAVEHIST=256 | |
HISTFILE=~/.zsh-history | |
# Visual stuff. | |
autoload colors; colors | |
if [[ x$WINDOW != x ]] | |
then | |
SCREEN_NO="%B$WINDOW%b " | |
else | |
SCREEN_NO="" | |
fi | |
# | |
# Color grep results | |
# Examples: http://rubyurl.com/ZXv | |
# | |
export GREP_OPTIONS='--color=auto' | |
export GREP_COLOR='1;32' | |
export LC_CTYPE=en_US.UTF-8 | |
# Directory stuff. | |
setopt AUTO_NAME_DIRS | |
# Speed stuff. | |
#setopt NO_BEEP | |
setopt AUTO_CD | |
setopt MULTIOS | |
setopt CDABLEVARS | |
alias c='cd' | |
alias pu='pushd' | |
alias po='popd' | |
alias mr='mate CHANGELOG app config db lib public script spec test' | |
alias .='pwd' | |
alias ...='cd ../..' | |
alias ....='cd ../../..' | |
alias .....='cd ../../../..' | |
alias ......='cd ../../../../..' | |
alias .......='cd ../../../../../..' | |
alias _='sudo' | |
alias ss='setsid' | |
alias s='svn' | |
alias e='mate' | |
alias g='git' | |
alias gc='git commit -m' | |
alias gca='git commit -a -m' | |
alias gch='git checkout' | |
alias gb='git branch' | |
alias gs='git status' | |
alias gd='git diff' | |
alias gp='git pull' | |
alias gpu='git push' | |
alias gis='git issues' | |
alias gl='git log' | |
alias ls='ls -GF' | |
alias rfind='find . -name *.rb | xargs grep -n' | |
bindkey '\ew' kill-region | |
bindkey -s '\el' "ls\n" | |
bindkey -s '\e.' "..\n" | |
# Shitty bloat | |
autoload -U incremental-complete-word | |
zle -N incremental-complete-word | |
bindkey "^Xi" incremental-complete-word ## C-x-i | |
#setopt EXTENDED_GLOB | |
setopt noautomenu | |
setopt COMPLETE_IN_WORD | |
setopt ALWAYS_TO_END | |
unsetopt flowcontrol | |
WORDCHARS='' | |
autoload -U compinit | |
compinit | |
zmodload -i zsh/complist | |
zstyle ':completion:*' list-colors '' | |
zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) | |
unsetopt MENU_COMPLETE | |
setopt AUTO_MENU | |
bindkey -M menuselect '^o' accept-and-infer-next-history | |
zstyle ':completion:*:*:*:*:*' menu yes select | |
# zstyle ':completion:*:*:*:*:processes' force-list always | |
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" | |
zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` | |
# hosts=(teepee wigwam google.com) | |
# zstyle ':completion:*' hosts $hosts | |
function preexec { | |
emulate -L zsh | |
local -a cmd; cmd=(${(z)1}) | |
} | |
function pap { curl -s $1 | patch -p0; } | |
# Environment variables. | |
export JS_DIST="/usr/local/spidermonkey" | |
export LD_LIBRARY_PATH="/usr/local/spidermonkey/lib" | |
export MAGICK_HOME="$HOME/src/ImageMagick-6.4.0" | |
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib:/usr/local/spidermonkey/lib" # :/opt/local/lib:/usr/local/lib/couchdb/js-src:~/src/js/src" | |
export EDITOR=/usr/bin/vim | |
export PAGER=less | |
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:$MAGICK_HOME/bin" | |
export LC_CTYPE=en_US.UTF-8 | |
_rake_does_task_list_need_generating () { | |
if [ ! -f .rake_tasks ]; then return 0; | |
else | |
accurate=$(stat -f%m .rake_tasks) | |
changed=$(stat -f%m Rakefile) | |
return $(expr $accurate '>=' $changed) | |
fi | |
} | |
_rake () { | |
if [ -f Rakefile ]; then | |
if _rake_does_task_list_need_generating; then | |
echo "\nGenerating .rake_tasks..." > /dev/stderr | |
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks | |
fi | |
compadd `cat .rake_tasks` | |
fi | |
} | |
compdef _rake rake | |
export __CURRENT_GIT_BRANCH= | |
# get the name of the branch we are on | |
parse_git_branch() { | |
git-branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
# on each chdir update the cached git variable(s) | |
typeset -ga chpwd_functions | |
chpwd_functions+='zsh_chpwd_update_git_vars' | |
# re-evaluate the git branch when changing directories | |
zsh_chpwd_update_git_vars() { | |
export __CURRENT_GIT_BRANCH="$(parse_git_branch)" | |
} | |
# this function returns the current git branch | |
get_git_prompt_info() { | |
if [[ $__CURRENT_GIT_BRANCH != '' ]]; then | |
export __CURRENT_GIT_BRANCH="$(parse_git_branch)" | |
fi | |
echo $__CURRENT_GIT_BRANCH | |
} | |
setopt prompt_subst | |
PS1='%~$(get_git_prompt_info)> ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment