1# 2# Example .zshrc file for zsh 4.0 3# 4# .zshrc is sourced in interactive shells. It 5# should contain commands to set up aliases, functions, 6# options, key bindings, etc. 7# 8 9# THIS FILE IS NOT INTENDED TO BE USED AS /etc/zshrc, NOR WITHOUT EDITING 10return 0 # Remove this line after editing this file as appropriate 11 12# Search path for the cd command 13cdpath=(.. ~ ~/src ~/zsh) 14 15# Use hard limits, except for a smaller stack and no core dumps 16unlimit 17limit stack 8192 18limit core 0 19limit -s 20 21umask 022 22 23# Set up aliases 24alias mv='nocorrect mv' # no spelling correction on mv 25alias cp='nocorrect cp' # no spelling correction on cp 26alias mkdir='nocorrect mkdir' # no spelling correction on mkdir 27alias j=jobs 28alias pu=pushd 29alias po=popd 30alias d='dirs -v' 31alias h=history 32alias grep=egrep 33alias ll='ls -l' 34alias la='ls -a' 35 36# List only directories and symbolic 37# links that point to directories 38alias lsd='ls -ld *(-/DN)' 39 40# List only file beginning with "." 41alias lsa='ls -ld .*' 42 43# Shell functions 44setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" } # csh compatibility 45freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done } 46 47# Where to look for autoloaded function definitions 48fpath=($fpath ~/.zfunc) 49 50# Autoload all shell functions from all directories in $fpath (following 51# symlinks) that have the executable bit on (the executable bit is not 52# necessary, but gives you an easy way to stop the autoloading of a 53# particular shell function). $fpath should not be empty for this to work. 54for func in $^fpath/*(N-.x:t); autoload $func 55 56# automatically remove duplicates from these arrays 57typeset -U path cdpath fpath manpath 58 59# Global aliases -- These do not have to be 60# at the beginning of the command line. 61alias -g M='|more' 62alias -g H='|head' 63alias -g T='|tail' 64 65manpath=($X11HOME/man /usr/man /usr/lang/man /usr/local/man) 66export MANPATH 67 68# Hosts to use for completion (see later zstyle) 69hosts=(`hostname` ftp.math.gatech.edu prep.ai.mit.edu wuarchive.wustl.edu) 70 71# Set prompts 72PROMPT='%m%# ' # default prompt 73RPROMPT=' %~' # prompt for right side of screen 74 75# Some environment variables 76export MAIL=/var/spool/mail/$USERNAME 77export LESS=-cex3M 78export HELPDIR=/usr/local/lib/zsh/help # directory for run-help function to find docs 79 80MAILCHECK=300 81HISTSIZE=200 82DIRSTACKSIZE=20 83 84# Watch for my friends 85#watch=( $(<~/.friends) ) # watch for people in .friends file 86watch=(notme) # watch for everybody but me 87LOGCHECK=300 # check every 5 min for login/logout activity 88WATCHFMT='%n %a %l from %m at %t.' 89 90# Set/unset shell options 91setopt notify globdots correct pushdtohome cdablevars autolist 92setopt correctall autocd recexact longlistjobs 93setopt autoresume histignoredups pushdsilent noclobber 94setopt autopushd pushdminus extendedglob rcquotes mailwarning 95unsetopt bgnice autoparamslash 96 97# Autoload zsh modules when they are referenced 98zmodload -a zsh/zpty zpty 99zmodload -a zsh/zprof zprof 100zmodload -ap zsh/mapfile mapfile 101# stat(1) is now commonly an external command, so just load zstat 102zmodload -aF zsh/stat b:zstat 103 104# Some nice key bindings 105#bindkey '^X^Z' universal-argument ' ' magic-space 106#bindkey '^X^A' vi-find-prev-char-skip 107#bindkey '^Xa' _expand_alias 108#bindkey '^Z' accept-and-hold 109#bindkey -s '\M-/' \\\\ 110#bindkey -s '\M-=' \| 111 112# bindkey -v # vi key bindings 113 114bindkey -e # emacs key bindings 115bindkey ' ' magic-space # also do history expansion on space 116bindkey '^I' complete-word # complete on tab, leave expansion to _expand 117 118# Setup new style completion system. To see examples of the old style (compctl 119# based) programmable completion, check Misc/compctl-examples in the zsh 120# distribution. 121autoload -Uz compinit 122compinit 123 124# Completion Styles 125 126# list of completers to use 127zstyle ':completion:*::::' completer _expand _complete _ignored _approximate 128 129# allow one error for every three characters typed in approximate completer 130zstyle -e ':completion:*:approximate:*' max-errors \ 131 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )' 132 133# insert all expansions for expand completer 134zstyle ':completion:*:expand:*' tag-order all-expansions 135 136# formatting and messages 137zstyle ':completion:*' verbose yes 138zstyle ':completion:*:descriptions' format '%B%d%b' 139zstyle ':completion:*:messages' format '%d' 140zstyle ':completion:*:warnings' format 'No matches for: %d' 141zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' 142zstyle ':completion:*' group-name '' 143 144# match uppercase from lowercase 145zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 146 147# offer indexes before parameters in subscripts 148zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters 149 150# command for process lists, the local web server details and host completion 151#zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args' 152#zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html' 153zstyle '*' hosts $hosts 154 155# Filename suffixes to ignore during completion (except after rm command) 156zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \ 157 '*?.old' '*?.pro' 158# the same for old style completion 159#fignore=(.o .c~ .old .pro) 160 161# ignore completion functions (until the _ignored completer) 162zstyle ':completion:*:functions' ignored-patterns '_*' 163