# $Id: .zshrc,v 1.11 2005/04/16 22:42:24 vogelke Exp $ # # This runs in interactive shells only # Set up the previous working directory. test -f $HOME/.current && . $HOME/.current # search path for the cd command cdpath=(.. ~ ) # default file permission umask 022 # exception for root/postgres users test -f $HOME/.Xauthority && chmod 644 $HOME/.Xauthority # ------------------------------------------------------------------------- # ALIASES alias 1='%1' alias 2='%2' alias 3='%3' alias 4='%4' alias 5='%5' alias 6='%6' alias 7='%7' alias 8='%8' alias 9='%9' # notebook: "today" is too close in spelling to "tidy", and the # shell is always asking if I want to correct it. alias today='cd $HOME/today' # http://www.us-webmasters.com/FreeBSD/Configuration/Shell/ # LiSt files with Largest last: alias lsl='ls -ablprtFT | sort -n +4' # LiSt files a page at a time with Largest shown first: alias lslm='ls -ablprtFT | sort -n +4 -r | less' # LiSt files with Smallest shown last: alias lss='ls -ablprtFT | sort -n +4 -r' # LiSt files a page at a time with the SMallest shown first: alias lssm='ls -ablprtFT | sort -n +4 | less' # LiSt files with the newly modified (Time) shown last: alias lst='ls -ablprtFT' # LiSt files a page at a time with the newly Modified (Time) shown first: alias lstm='ls -ablptFT | less' # LiSt files sorted by name: alias lsn='ls -ablptFT | sort +9' # LiSt files sorted by Name a page at a tiMe: alias lsnm='ls -ablptFT | sort +9 | less' alias a='agenda' alias back='cd "$current"' alias bk='backup' alias cl='clear' alias cp='nocorrect cp' # no spelling correction on cp alias d='/bin/ls -ld *(-/)' alias dir='ls -lF' alias dot='ls -ldF .[a-zA-Z0-9]*' alias fix='source ~/.termrc.xterm' alias j='jobs -dl' alias ls='ls -F' alias mkdir='nocorrect mkdir' # no spelling correction on mkdir alias mv='nocorrect mv' # no spelling correction on mv alias p='less' alias path='which -a' alias restart='op restart' alias rh='rehash' alias syslog='less +G /var/log/syslog' alias uc='who | cut -f1 -d" " | sort | uniq | wc -w' alias unsetenv=unset alias x='ls -laF | fgrep "*"' alias yell='echo done | write $LOGNAME' alias z='suspend' # number conversions - brian d foy alias d2h="perl -e 'printf qq|%X\n|, int( shift )'" alias h2d="perl -e 'printf qq|%d\n|, hex( shift )'" # replace run-help alias with home-grown version unalias run-help alias run-help=zman # ------------------------------------------------------------------------- # THINGS WE DON'T WANT # the builtin pwd prints the symbolic link instead of the real directory disable pwd # ------------------------------------------------------------------------- # PROMPT - different if we're running saveon. # Allow for colors fpath=(~/zprompt $fpath) autoload -U promptinit promptinit PROMPT=" (%D{%a %f %b %T}) <%?> [%~] $program %n at %m.%l ($SHLVL-%!-z)%# " case "$SAVEON" in "") ;; *) prompt save ;; esac # ------------------------------------------------------------------------- # ENVIRONMENT export MAILCALL='NEW MAIL! ' export MAILCHECK=30 mailpath=(/var/mail/$USERNAME) export YOUSAID='In %C you wrote:' export ATTRIBUTION='%f wrote:' export HELPDIR=/usr/local/zsh/help # docs for run-help function # set the environment variable for running the Korn Shell #export ENV=$HOME/.kshrc # default pager export PAGER="less" # No X-windows: just after system installation #export TERM=cons25 # X-windows #export TERM=xterm export TERM=xterm-color export TERMINFO=/usr/local/lib/terminfo test -f $HOME/.xmodmaprc && xmodmap $HOME/.xmodmaprc # export TERMCAP=~/terminfo/vt100k.cap # ------------------------------------------------------------------------- # HISTORY # we have to read the saved history when we start the shell; see # the exit function for commands to save current history on logout. export HISTSIZE=2000 export HISTFILE="$HOME/.savehist" export SAVEHIST=2000 alias h='fc -l 1 | less' alias history='fc -l 1' test -f $HOME/.history && fc -R $HOME/.history # max size of the directory stack DIRSTACKSIZE=20 # functions to autoload # # To change a function after it's been loaded, do the following: # unhash function-name # edit the function # autoload function # or source the filename. #autoload `ls ~/.zfunc | grep -v RCS` test -f ~/.zfunc && source ~/.zfunc # only run chpwd if X-windows is running. case "$XFILESEARCHPATH" in "") ;; *) chpwd ;; esac # ------------------------------------------------------------------------- # COMPLETION # # Set up new style completion system. To see examples of the # old style (compctl based) programmable completion, check # Misc/compctl-examples in the zsh distribution. autoload -U compinit compinit # Completion Styles: # list of completers to use zstyle ':completion:*::::' completer _expand _complete _ignored _approximate # allow one error for every three characters typed in approximate completer zstyle -e ':completion:*:approximate:*' max-errors \ 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )' # insert all expansions for expand completer zstyle ':completion:*:expand:*' tag-order all-expansions # formatting and messages zstyle ':completion:*' verbose yes zstyle ':completion:*:descriptions' format '%B%d%b' zstyle ':completion:*:messages' format '%d' zstyle ':completion:*:warnings' format 'No matches for: %d' zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' zstyle ':completion:*' group-name '' # match uppercase from lowercase zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # offer indexes before parameters in subscripts zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters # command for process lists, the local web server details and host completion #zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args' #zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html' test -f $HOME/.hosts && hosts=(`cat $HOME/.hosts`) zstyle '*' hosts $hosts # Filename suffixes to ignore during completion (except after rm command) zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \ '*?.old' '*?.pro' # the same for old style completion #fignore=(.o .c~ .old .pro) # ignore completion functions (until the _ignored completer) zstyle ':completion:*:functions' ignored-patterns '_*' ## ------------------------------- ## generated from compinstall, but I'm not sure how these work, ## so leave them commented out. ## The following lines were added by compinstall # #zstyle ':completion:*' completer _expand _complete _correct _approximate #zstyle ':completion:*' completions 1 #zstyle ':completion:*' glob 1 #zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'm:{a-zA-Z}={A-Za-z}' 'm:{a-zA-Z}={A-Za-z}' 'm:{a-zA-Z}={A-Za-z}' #zstyle ':completion:*' max-errors 1 numeric #zstyle ':completion:*' squeeze-slashes true #zstyle ':completion:*' substitute 1 #zstyle :compinstall filename '/home/vogelke/.zshcomp' # #autoload -Uz compinit #compinit ## End of lines added by compinstall ## ------------------------------- # ------------------------------------------------------------------------- # OPTIONS setopt appendhistory # append to the zsh history file setopt autocd # go to a directory if first word on command line # is not a command but is a directory setopt autoresume # single-word commands may resume a suspended job setopt cdablevars # allows cd'ing to a parameter setopt correct # try to correct the spelling of commands setopt csh_junkie_loops # allow short form of loops: list; end setopt extendedglob # allow # and ^ to be used for filename generation setopt globdots # don't require leading . in filename to be matched setopt histignoredups # don't store duplicate lines in command history setopt histnostore # don't store history commands in history setopt ignoreeof # don't logout using Control-D setopt longlistjobs # list jobs in long format by default setopt markdirs # append trailing / to dirnames setopt menucomplete # cycle through completions when ambiguous #setopt menucompletebeep # beep on ambiguous completion setopt numeric_globsort # sort numeric filenames numerically setopt noclobber # don't overwrite existing files setopt notify # tell me when a job finishes setopt rcquotes # '' = single quote in single-quoted strings unsetopt bgnice # don't run background jobs at lower priority # ------------------------------------------------------------------------- # KEYBINDINGS # run under emacs commandline mode bindkey -e bindkey ' ' magic-space # also do history expansion on space # set the default printer; must be done here because we need the setenv # function test -f $HOME/.printer && eval setenv `cat $HOME/.printer` case "$WINDOWID" in "") ;; *) xhost + 192.168.1.13 192.168.1.14 192.168.1.15 ;; esac