Most of this is from Why's .zshrc at the moment. Emacs code-folding is like crack.
# File: ~/.zshrc
# Author: Burke Libbey <b.libbey@gmail.com>
# Modified: $Date: 2008/01/21 03:11:00 $
# {{{ Environment ###########################################################
source /sw/bin/init.sh
export EDITOR="emacs"
export BROWSER="w3m"
export DEITY="fsm"
export PAGER="less"
export PATH=$PATH":~/bin:/usr/local/bin:/opt/local/bin"
setopt CORRECT
# }}}
# {{{ Miscellaneous #########################################################
# history
HISTFILE=~/.zsh_history
HISTSIZE=5000
SAVEHIST=1000
setopt appendhistory autocd extendedglob
# Emacs editing
bindkey -e
# }}}
# {{{ Prompts ###############################################################
# Colorize red for root, green for normal users. It's Gentoolicious!
if [[ "$USER" == "root" ]]; then
COLOR="%{ [0m [01;31m%}"
else
COLOR="%{ [0m [01;32m%}"
fi
# prompt (if running screen, show window #)
if [ x$WINDOW != x ]; then
export PS1="$COLOR$WINDOW:%{ [01;34m%}%~ $COLOR%#%{ [0m%} "
else
export PS1="%{ [01;34m%}%~ $COLOR%#%{ [0m%} "
fi
# If we're using a dumb terminal (ie. emacs), assume we don't want colour.
if [[ "$TERM" == "dumb" ]]; then
export PS1="%~ %# "
fi
# }}}
# {{{ Titles ################################################################
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")
s="%39>...>$a:$3"
case $TERM in
screen)
print -Pn "\ek$s\e\\" # screen title (in ^H")
;;
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" "%35<...<%~" }
# preexec is called just before any command line is executed
function preexec() { title "$1" "$USER@%m" "%55<...<%~" }
# }}}
# {{{ Completion ############################################################
# colorful listings
zmodload -i zsh/complist
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
autoload -U compinit
compinit
# cache completions
zstyle ':completion::complete:*' use-cache 1
# }}}
# {{{ Functions #############################################################
mdc() { mkdir -p "$1" && cd "$1" }
setenv() { export $1=$2 }
sdate() { date +%Y.%m.%d }
pc() { awk "{print \$$1}" }
# }}}
# {{{ Aliases ###############################################################
alias mv='nocorrect mv'
alias cp='nocorrect cp'
alias mkdir='nocorrect mkdir'
alias j=jobs
if ls -F --color=auto >&/dev/null; then
alias ls="ls --color=auto -F"
else
alias ls="ls -GF"
fi
alias cl="clear;ls"
alias ll="ls -l"
alias l.='ls -d .[^.]*'
alias lsd='ls -ld *(-/DN)'
alias md='mkdir -p'
alias rd='rmdir'
alias cd..='cd ..'
alias ..='cd ..'
alias po='popd'
alias pu='pushd'
alias tsl="tail -f /var/log/syslog"
alias df="df -hT"
alias em="emacs -nw"
alias sc="screen"
alias scr="screen -r"
alias su="su -s /bin/zsh"
# }}}