diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Etc/FEATURES | 4 | ||||
-rw-r--r-- | StartupFiles/zshrc | 107 |
3 files changed, 77 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog index d1031bf7d..39c58e024 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2001-05-09 Oliver Kiddle <opk@zsh.org> + * 14266, 14283: Etc/FEATURES, StartupFiles/zshrc: update; in + particular to use new style completion in example startup file. + * 14282: Completion/Unix/Command/_chown: complete only files that can be chowned. diff --git a/Etc/FEATURES b/Etc/FEATURES index 1953a5de1..4734d80f8 100644 --- a/Etc/FEATURES +++ b/Etc/FEATURES @@ -5,13 +5,13 @@ ZSH FEATURES very close to ksh/sh grammar, with csh additions most features of ksh, bash, and tcsh can emulate ksh or POSIX sh -81 builtins, 102 options, 162 key bindings +100 builtins, 145 options, 166 key bindings short for loops, ex: for i (*.c) echo $i select shell functions conditional expressions (test builtin, [ ... ], and ksh-style [[ ... ]]) global aliases (may be expanded anywhere on the line) -directory stack access with =num +directory stack access with ~num process substitution (vi =(cmd) edits the output of cmd) generalized pipes (ls foo >>(cmd1) 2>>(cmd2) pipes stdout to cmd1 and stderr to cmd2) diff --git a/StartupFiles/zshrc b/StartupFiles/zshrc index 130023857..88eea069e 100644 --- a/StartupFiles/zshrc +++ b/StartupFiles/zshrc @@ -1,5 +1,5 @@ # -# Generic .zshrc file for zsh 2.7 +# Example .zshrc file for zsh 4.0 # # .zshrc is sourced in interactive shells. It # should contain commands to set up aliases, functions, @@ -41,20 +41,20 @@ alias lsd='ls -ld *(-/DN)' alias lsa='ls -ld .*' # Shell functions -setenv() { export $1=$2 } # csh compatibility +setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" } # csh compatibility +freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done } # Where to look for autoloaded function definitions -fpath=(~/.zfunc) - -# Autoload all shell functions from all directories -# in $fpath that have the executable bit on -# (the executable bit is not necessary, but gives -# you an easy way to stop the autoloading of a -# particular shell function). -for dirname in $fpath -do - autoload $dirname/*(.x:t) -done +fpath=($fpath ~/.zfunc) + +# Autoload all shell functions from all directories in $fpath (following +# symlinks) that have the executable bit on (the executable bit is not +# necessary, but gives you an easy way to stop the autoloading of a +# particular shell function). $fpath should not be empty for this to work. +for func in $^fpath/*(N-.x:t); autoload $func + +# automatically remove duplicates from these arrays +typeset -U path cdpath fpath manpath # Global aliases -- These do not have to be # at the beginning of the command line. @@ -65,10 +65,7 @@ alias -g T='|tail' manpath=($X11HOME/man /usr/man /usr/lang/man /usr/local/man) export MANPATH -# Filename suffixes to ignore during completion -fignore=(.o .c~ .old .pro) - -# Hosts to use for completion +# Hosts to use for completion (see later zstyle) hosts=(`hostname` ftp.math.gatech.edu prep.ai.mit.edu wuarchive.wustl.edu) # Set prompts @@ -85,7 +82,7 @@ HISTSIZE=200 DIRSTACKSIZE=20 # Watch for my friends -#watch=($(cat ~/.friends)) # watch for people in .friends file +#watch=( $(<~/.friends) ) # watch for people in .friends file watch=(notme) # watch for everybody but me LOGCHECK=300 # check every 5 min for login/logout activity WATCHFMT='%n %a %l from %m at %t.' @@ -97,28 +94,68 @@ setopt autoresume histignoredups pushdsilent noclobber setopt autopushd pushdminus extendedglob rcquotes mailwarning unsetopt bgnice autoparamslash -# Setup some basic programmable completions. To see more examples -# of these, check Misc/compctl-examples in the zsh distribution. -compctl -g '*(-/)' cd pushd -compctl -g '*(/)' rmdir dircmp -compctl -j -P % -x 's[-] p[1]' -k signals -- kill -compctl -j -P % fg bg wait jobs disown -compctl -A shift -compctl -caF type whence which -compctl -F unfunction -compctl -a unalias -compctl -v unset typeset declare vared readonly export integer -compctl -e disable -compctl -d enable +# Autoload zsh modules when they are referenced +zmodload -a zsh/stat stat +zmodload -a zsh/zpty zpty +zmodload -a zsh/zprof zprof +zmodload -ap zsh/mapfile mapfile # Some nice key bindings #bindkey '^X^Z' universal-argument ' ' magic-space #bindkey '^X^A' vi-find-prev-char-skip +#bindkey '^Xa' _expand_alias #bindkey '^Z' accept-and-hold #bindkey -s '\M-/' \\\\ #bindkey -s '\M-=' \| -# bindkey -v # vi key bindings - -bindkey -e # emacs key bindings -bindkey ' ' magic-space # also do history expansino on space +# bindkey -v # vi key bindings + +bindkey -e # emacs key bindings +bindkey ' ' magic-space # also do history expansion on space +bindkey '^I' complete-word # complete on tab, leave expansion to _expand + +# Setup 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' +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 '_*' |