josephholsten /.zshrc

A bunch of aliases and environment variables. I've stolen some of _why's screen/xterm titling. The ls colors are hand tweaked for beauty on a dark, transparent mac terminal. They don't play nice with gnu ls. Still don't understand the style stuff at the top.
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' file-sort name
zstyle ':completion:*' group-name ''
zstyle ':completion:*' ignore-parents parent pwd
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'r:|[._-]=** r:|=**'
zstyle ':completion:*' max-errors 1
zstyle ':completion:*' menu select=0
zstyle ':completion:*' original true
zstyle ':completion:*' prompt 'correct %e errors'
zstyle ':completion:*' squeeze-slashes true
zstyle :compinstall filename "$HOME/.zshrc"

autoload -Uz compinit
compinit

HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt autocd extendedglob nomatch
unsetopt beep notify

# vi editing
bindkey -v

# prompt: machine (if running screen, show window #) path
if [ x$WINDOW != x ]; then
    export PS1="%m[$WINDOW]:%~%# "
else
    export PS1='%m:%~ %# '
fi

export   PATH=$HOME/.bin:/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin:$PATH:/usr/local/bin
export   VISUAL=vim
export   CLICOLOR=1
export   PYTHONPATH=/usr/local/lib/python2.4/site-packages
unsetopt BG_NICE
setopt   AUTO_LIST
setopt   CHASE_LINKS
setopt   NUMERIC_GLOB_SORT
setopt   PRINT_EXIT_VALUE
export   SVN_EDITOR=vi
export   PATH="$HOME/.bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export   TM_RUBY=/opt/local/bin/ruby
export   EDITOR=mate
alias    sha1sum=gsha1sum
alias    screen="screen -Rd"
alias    ssh="ssh -v"
alias    @=$EDITOR
alias    ls="ls -FG"
alias    vi=vim
alias    cls="clear"
alias    ps="ps waux"

# _why's majik screen titles
# format titles for screen and rxvt
function title() {
  # escape '%' chars in $1, make nonprintables visible
  a=${(V)1//\%/\%\%}

  # Truncate command, and join lines.
  a=$(print -Pn "%40>...>$a" | tr -d "\n")

  case $TERM in
  screen)
    print -Pn "\ek$a:$3\e\\"      # screen title (in ^A")
    ;;
  xterm*|rxvt)
    print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title
    ;;
  esac
}

# precmd is called just before the prompt is printed
function precmd() {
  title "zsh" "$USER@%m" "%55<...<%~"
}

# preexec is called just before any command line is executed
function preexec() {
  title "$1" "$USER@%m" "%35<...<%~"
}


# Mac specific stuff
export LSCOLORS=gxfxcxexdxbebgdbdfgfge
alias  apache4ctl="sudo /opt/local/apache2/bin/apachectl"