head	2.12;
access;
symbols
	3_0_1:2.12
	3_0_0:2.12
	3_0-pre6:2.11
	3_0-pre5:2.11
	3_0-pre4:2.10
	beta15:1.11
	beta14:1.11
	beta13:1.11
	beta12:1.11
	beta11:1.11
	beta10:1.10
	3_0-pre3:2.9
	3_0-pre2:2.7
	3_0-pre1:2.5
	beta21:2.5
	beta20:2.4
	beta19:2.3
	beta18:2.3
	beta17:2.3
	beta16:2.0;
locks;
comment	@# @;


2.12
date	96.08.14.17.01.36;	author hzoli;	state Exp;
branches;
next	2.11;

2.11
date	96.07.28.22.30.56;	author hzoli;	state Exp;
branches;
next	2.10;

2.10
date	96.07.19.01.48.36;	author hzoli;	state Exp;
branches;
next	2.9;

2.9
date	96.07.15.04.43.21;	author hzoli;	state Exp;
branches;
next	2.8;

2.8
date	96.07.15.01.10.22;	author hzoli;	state Exp;
branches;
next	2.7;

2.7
date	96.07.01.19.08.35;	author hzoli;	state Exp;
branches;
next	2.6;

2.6
date	96.07.01.19.07.26;	author hzoli;	state Exp;
branches;
next	2.5;

2.5
date	96.06.16.18.50.47;	author hzoli;	state Exp;
branches;
next	2.4;

2.4
date	96.06.06.00.31.05;	author hzoli;	state Exp;
branches;
next	2.3;

2.3
date	96.05.05.00.32.24;	author hzoli;	state Exp;
branches;
next	2.2;

2.2
date	96.05.05.00.24.34;	author hzoli;	state Exp;
branches;
next	2.1;

2.1
date	96.05.05.00.24.33;	author hzoli;	state Exp;
branches;
next	2.0;

2.0
date	96.05.02.22.57.04;	author hzoli;	state Exp;
branches;
next	1.11;

1.11
date	95.09.17.05.50.08;	author coleman;	state Exp;
branches;
next	1.10;

1.10
date	95.05.25.09.34.19;	author coleman;	state Exp;
branches;
next	1.9;

1.9
date	95.05.19.08.38.42;	author coleman;	state Exp;
branches;
next	1.8;

1.8
date	95.05.07.07.14.02;	author coleman;	state Exp;
branches;
next	1.7;

1.7
date	95.03.31.21.19.11;	author coleman;	state Exp;
branches;
next	1.6;

1.6
date	95.03.18.06.21.10;	author coleman;	state Exp;
branches;
next	1.5;

1.5
date	95.03.18.03.56.37;	author coleman;	state Exp;
branches;
next	1.4;

1.4
date	95.03.18.03.47.55;	author coleman;	state Exp;
branches;
next	1.3;

1.3
date	95.02.23.09.25.33;	author coleman;	state Exp;
branches;
next	1.2;

1.2
date	95.01.24.04.58.01;	author coleman;	state Exp;
branches;
next	1.1;

1.1
date	94.11.08.06.56.34;	author zsh;	state Exp;
branches;
next	;


desc
@@


2.12
log
@# a cosmetic patch from Bart (1919)
@
text
@# $Id: compctl-examples,v 2.11 1996/07/28 22:30:56 hzoli Exp $
#
# This file gives examples of possible programmable completions (compctl).
# You can either put the compctl commands in your .zshrc file, or put them
# in a separate file (say .zcompctl) and source it from your .zshrc file.
#
# These are just examples. Use and modify to personal taste.  Copying
# this file without thought will needlessly increase zsh's memory usage
# and startup time.
#
# For a detailed description of how these work, check the zshcompctl man
# page.
#
#------------------------------------------------------------------------------

# groups=( $(cut -d: -f1 /etc/group) )
# groups=( $(ypcat group.byname | cut -d: -f1) ) # if you use NIS

# It can be done without forking, but it used too much memory in old zsh's:
groups=( "${${(f)$(</etc/group)}%%:*}" )
#groups=( "${${(f)$(ypcat groups)}%%:*}" ) # if you use NIS

# Completion for zsh builtins.
compctl -z -P '%' bg
compctl -j -P '%' fg jobs disown
compctl -j -P '%' + -s '`ps -x | tail +2 | cut -c1-5`' wait
compctl -A shift
compctl -caF type whence which
compctl -c unhash
compctl -x 'w[1,-d] p[2]' -n - 'w[1,-d] p[3]' -g '*(-/)' - \
	'p[1]' -c - 'p[2]' -g '*(-x)' -- hash
compctl -F functions unfunction
compctl -a unalias
compctl -v getln getopts read unset vared
compctl -v -S '=' -q declare export integer local readonly typeset
compctl -eB -x 'p[1] s[-]' -k '(a f m r)' - \
	'C[1,-*a*]' -ea - 'C[1,-*f*]' -eF - 'C[-1,-*r*]' -ew -- disable
compctl -dB -x 'p[1] s[-]' -k '(a f m r)' - \
	'C[1,-*a*]' -da - 'C[1,-*f*]' -dF - 'C[-1,-*r*]' -dw -- enable
compctl -k "(`limit | cut -d' ' -f1`)" limit unlimit
compctl -l '' -x 'p[1]' -f -- . source
# Redirection below makes zsh silent when completing unsetopt xtrace
compctl -s '$(setopt 2>/dev/null)' + -s 'no${=^$(unsetopt)}' + -o unsetopt
compctl -s '$(unsetopt)' + -s 'no${=^$(setopt 2>/dev/null)}' + -o setopt
compctl -s '${^fpath}/*(N:t)' autoload
compctl -b bindkey
compctl -c -x 'C[-1,-*k]' -A - 'C[-1,-*K]' -F -- compctl
compctl -x 'C[-1,-*e]' -c - 'C[-1,-[ARWI]##]' -f -- fc
compctl -x 'p[1]' - 'p[2,-1]' -l '' -- sched
compctl -x 'C[-1,[+-]o]' -o - 'c[-1,-A]' -A -- set

# Anything after nohup is a command by itself with its own completion
compctl -l '' nohup noglob exec nice eval - time rusage
compctl -l '' -x 'p[1]' -eB -- builtin
compctl -l '' -x 'p[1]' -em -- command
compctl -x 'p[1]' -c - 'p[2,-1]' -k signals -- trap
#------------------------------------------------------------------------------
# kill takes signal names as the first argument after -, but job names after %
# or PIDs as a last resort
compctl -j -P '%' + -s '`ps -x | tail +2 | cut -c1-5`' + \
	-x 's[-] p[1]' -k "($signals[1,-3])" -- kill
#------------------------------------------------------------------------------
compctl -s '$(groups)' + -k groups newgrp
compctl -f -x 'p[1], p[2] C[-1,-*]' -k groups -- chgrp
compctl -f -x 'p[1] n[-1,.], p[2] C[-1,-*] n[-1,.]' -k groups \
	- 'p[1], p[2] C[-1,-*]' -u -S '.' -- chown
compctl -g '*.x' + -g '*(-/)' rpcgen
compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' - \
	's[-f],c[-1,-f]' -f -- mail elm
#------------------------------------------------------------------------------
compctl -s "\$(awk '/^[a-zA-Z0-9][^ 	]+:/ {print \$1}' FS=: [mM]akefile)" -x \
	'c[-1,-f]' -f -- make gmake
compctl -f -x 'C[-1,*f*] p[2]' -g "*.tar" -- tar
#------------------------------------------------------------------------------
# rmdir only real directories
compctl -g '*(/)' rmdir dircmp
#------------------------------------------------------------------------------
# cd/pushd only directories or symbolic links to directories
compctl -g '*(-/)' cd pushd

# Another possibility for cd/pushd is to use it in conjunction with the
# cdmatch function (in the Functions subdirectory of zsh distribution).
if [[ -o AUTO_REMOVE_SLASH ]] then
    compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
	-g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -q -S '/' -- cd pushd
else
    compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
	-g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
fi
#------------------------------------------------------------------------------
# If the command is rsh, make the first argument complete to hosts and treat the
# rest of the line as a command on its own.
compctl -k hosts -x 'p[2,-1]' -l '' -- rsh

# rlogin takes hosts and users after `-l'
compctl -k hosts -x 'c[-1,-l]' -u -- rlogin

# rcp: match files *and* hosts initially, match files after a :, if the first
# argument contained a : then the second matches files and vice versa.
compctl -f -k hosts -x 'n[1,:]' -f - \
	'p[1] W[2,*:*]' -f - 'p[1]' -k hosts -S ':' - \
	'p[2] W[1,*:*]' -f - 'p[2]' -k hosts -S ':' -- rcp
#------------------------------------------------------------------------------
# strip, profile, and debug only executables.  The compctls for the
# debuggers could be better, of course.
compctl -g '*(*)' strip gprof adb dbx xdbx ups
#------------------------------------------------------------------------------
# su takes an username and args for the shell.  The `-c' case is
# handled specially here.
compctl -u -x 'w[2,-c] p[3,-1]' -l '' -- su
#------------------------------------------------------------------------------
# Run ghostscript on postscript files, but if no postscript file matches what
# we already typed, complete directories as the postscript file may not be in
# the current directory.
compctl -g '*.(e|)ps' + -g '*(-/)' gs ghostview psps pstops psmulti psselect
#------------------------------------------------------------------------------
# Similar things for tex, texinfo and dvi files.
compctl -g '*.tex*' + -g '*(-/)' {,la,gla,ams{la,},{g,}sli}tex texi2dvi
compctl -g '*.dvi' + -g '*(-/)' xdvi dvips
#------------------------------------------------------------------------------
# For rcs users, co and rlog from the RCS directory.  We don't want to see
# the RCS and ,v though.
compctl -g 'RCS/*(:s@@RCS/@@@@:s/,v//)' co rlog rcs rcsdiff
#------------------------------------------------------------------------------
# gzip uncompressed files, but gzip -d only gzipped or compressed files
compctl -x 'R[-*[dt],^*]' -g '*.(gz|z|Z|t[agp]z|tarZ|tz)' + -g '*(-/)' + -f - \
    's[]' -g '^*(.(tz|gz|t[agp]z|tarZ|zip|ZIP|jpg|JPG|gif|GIF|[zZ])|[~#])' \
    + -f -- gzip
compctl -g '*.(gz|z|Z|t[agp]z|tarZ|tz)' + -g '*(-/)' gunzip # zcat if you use GNU
compctl -g '*.Z' + -g '*(-/)' uncompress zmore  # zcat if you don't use GNU
compctl -g '*.F' + -g '*(-/)' melt fcat
#------------------------------------------------------------------------------
# ftp takes hostnames
ftphosts=(prep.ai.mit.edu wuarchive.wustl.edu ftp.uu.net ftp.math.gatech.edu)
compctl -k ftphosts ftp

# Some systems have directories containing indices of ftp servers.
# For example: we have the directory /home/ftp/index/INDEX containing
# files of the form `<name>-INDEX.Z', this leads to:
compctl -g '/home/ftp/index/INDEX/*-INDEX.Z(:t:r:s/-INDEX//)' ftp tftp
#------------------------------------------------------------------------------
# Change default completion (see the multicomp function in the Function
# subdirectory of the zsh distribution).
compctl -D -f + -U -K multicomp
# If completion of usernames is slow for you, you may want to add something
# like
#    -x 'C[0,*/*]' -f - 's[~]' -S/ -k users + -u
# where `users' contains the names of the users you want to complete often.
# If you want to use this and to be able to complete named directories after
# the `~' you should add `+ -n' at the end
#------------------------------------------------------------------------------
# This is to complete all directories under /home, even those that are not
# yet mounted (if you use the automounter).

# This is for NIS+ (e.g. Solaris 2.x)
compctl -Tx 's[/home/] C[0,^/home/*/*]'  -S '/' -s '$(niscat auto_home.org_dir | \
	awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'

# And this is for YP (e.g. SunOS4.x)
compctl -Tx 's[/home/] C[0,^/home/*/*]' -S '/' -s '$(ypcat auto.home | \
	awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'
#------------------------------------------------------------------------------
# Find is very system dependent, this one is for GNU find.
# Note that 'r[-exec,;]' must come first
# On Linux use 'c[-1,-fstype]' -s '$(cut -f2 /proc/filesystems)' 
compctl -x 'r[-exec,;][-ok,;]' -l '' - \
's[-]' -s 'daystart {max,min,}depth follow noleaf version xdev \
	{a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \
	{i,}{l,}name {no,}{user,group} path perm regex size true uid used \
	exec {f,}print{f,0,} ok prune ls' - \
'p[1]' -g '. .. *(-/)' - \
'C[-1,-((a|c|)newer|fprint(|0|f))]' -f - \
'c[-1,-fstype]' -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' - \
'c[-1,-group]' -k groups - \
'c[-1,-user]' -u -- find
#------------------------------------------------------------------------------
# Generic completion for C compiler.
compctl -g "*.[cCoa]" -x 's[-I]' -g "*(/)" - \
	's[-l]' -s '${(s.:.)^LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' -- cc
#------------------------------------------------------------------------------
# GCC completion, by Andrew Main
# completes to filenames (*.c, *.C, *.o, etc.); to miscellaneous options after
# a -; to various -f options after -f (and similarly -W, -g and -m); and to a
# couple of other things at different points.
# The -l completion is nicked from the cc compctl above.
# The -m completion should be tailored to each system; the one below is i386.
compctl -g '*.([cCmisSoa]|cc|cxx|ii)' -x \
	's[-l]' -s '${(s.:.)^LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' - \
	'c[-1,-x]' -k '(none c objective-c c-header c++ cpp-output assembler assembler-with-cpp)' - \
	'c[-1,-o]' -f - \
	'C[-1,-i(nclude|macros)]' -g '*.h' - \
	'C[-1,-i(dirafter|prefix)]' -g '*(-/)' - \
	's[-B][-I][-L]' -g '*(-/)' - \
	's[-fno-],s[-f]' -k '(all-virtual cond-mismatch dollars-in-identifiers enum-int-equiv external-templates asm builtin strict-prototype signed-bitfields signd-char this-is-variable unsigned-bitfields unsigned-char writable-strings syntax-only pretend-float caller-saves cse-follow-jumps cse-skip-blocks delayed-branch elide-constructors expensive-optimizations fast-math float-store force-addr force-mem inline-functions keep-inline-functions memoize-lookups default-inline defer-pop function-cse inline peephole omit-frame-pointer rerun-cse-after-loop schedule-insns schedule-insns2 strength-reduce thread-jumps unroll-all-loops unroll-loops)' - \
	's[-g]' -k '(coff xcoff xcoff+ dwarf dwarf+ stabs stabs+ gdb)' - \
	's[-mno-][-mno][-m]' -k '(486 soft-float fp-ret-in-387)' - \
	's[-Wno-][-W]' -k '(all aggregate-return cast-align cast-qual char-subscript comment conversion enum-clash error format id-clash-6 implicit inline missing-prototypes missing-declarations nested-externs import parentheses pointer-arith redundant-decls return-type shadow strict-prototypes switch template-debugging traditional trigraphs uninitialized unused write-strings)' - \
	's[-]' -k '(pipe ansi traditional traditional-cpp trigraphs pedantic pedantic-errors nostartfiles nostdlib static shared symbolic include imacros idirafter iprefix iwithprefix nostdinc nostdinc++ undef)' -X 'Use "-f", "-g", "-m" or "-W" for more options' -- gcc g++
#------------------------------------------------------------------------------
# There are (at least) two ways to complete manual pages.  This one is
# extremely memory expensive if you have lots of man pages
man_var() {
   man_pages=( ${^manpath}/man*/*(N:t:r) )
   compctl -k man_pages man
   reply=( $man_pages )
}
compctl -K man_var man

# This one isn't that expensive but somewhat slower
man_glob () {
   local a
   read -cA a
   if [[ $a[2] = -s ]] then         # Or [[ $a[2] = [0-9]* ]] for BSD
     reply=( ${^manpath}/man$a[3]/$1*$2(N:t:r) )
   else
     reply=( ${^manpath}/man*/$1*$2(N:t:r) )
   fi
}
compctl -K man_glob man
#------------------------------------------------------------------------------
# xsetroot: gets possible colours, cursors and bitmaps from wherever.
# Uses two auxiliary functions.  You might need to change the path names.
# The =:- can be omitted if you use a beta6-hzoli4 or later version.
Xcolours() {
  reply=( ${(L)=:-$(awk '{ if (NF = 4) print $4 }' < /usr/openwin/lib/X11/rgb.txt)} )
}
Xcursor() {
  reply=( $(sed -n 's/^#define[	 ][ 	]*XC_\([^ 	]*\)[ 	].*$/\1/p' \
	  < /usr/include/X11/cursorfont.h) )
}
compctl -k '(-help -def -display -cursor -cursor_name -bitmap -mod -fg -bg
   -grey -rv -solid -name)' -x 'c[-1,-display]' -k hosts -S ':0.0' - \
   'c[-1,-cursor]' -f -  'c[-2,-cursor]' -f - \
   'c[-1,-bitmap]' -g '/usr/include/X11/bitmaps/*' - \
   'c[-1,-cursor_name]' -K Xcursor - \
   'C[-1,-(solid|fg|bg)]' -K Xcolours -- xsetroot
#------------------------------------------------------------------------------
# dd
compctl -k '(if of conv ibs obs bs cbs files skip file seek count)' \
	-S '=' -x 's[if=], s[of=]' -f - 'C[0,conv=*,*] n[-1,,], s[conv=]' \
	-k '(ascii ebcdic ibm block unblock lcase ucase swap noerror sync)' \
	-q -S ',' - 'n[-1,=]' -X '<number>'  -- dd
#------------------------------------------------------------------------------
# Various MH completions by Peter Stephenson
# You may need to edit where it says *Edit Me*.

# The following three functions are best autoloaded.
# mhcomp completes folders (including subfolders),
# mhfseq completes sequence names and message numbers,
# mhfile completes files in standard MH locations.

function mhcomp {
  # Completion function for MH folders.
  # Works with both + (rel. to top) and @@ (rel. to current).
  local nword args pref char mhpath
  read -nc nword
  read -cA args

  pref=$args[$nword]
  char=$pref[1]
  pref=$pref[2,-1]

  # The $(...) here accounts for most of the time spent in this function.
  if [[ $char = + ]]; then
  #    mhpath=$(mhpath +)
  # *Edit Me*: use a hard wired value here: it's faster.
    mhpath=~/Mail
  elif [[ $char = @@ ]]; then
    mhpath=$(mhpath)
  fi

  eval "reply=($mhpath/$pref*(N-/))"

  # I'm frankly amazed that this next step works, but it does.
  reply=(${reply#$mhpath/})
}

mhfseq() {
  # Extract MH message names and numbers for completion.  Use of the
  # correct folder, if it is not the current one, requires that it
  # should be the previous command line argument.  If the previous
  # argument is `-draftmessage', a hard wired draft folder name is used.

  local folder foldpath words pos nums
  read -cA words
  read -cn pos

  # Look for a folder name.
  # First try the previous word.
  if [[ $words[$pos-1] = [@@+]* ]]; then
    folder=$words[$pos-1]
  # Next look and see if we're looking for a draftmessage
  elif [[ $words[$pos-1] = -draftmessage ]]; then
    # *Edit Me*:  shortcut -- hard-wire draftfolder here
    # Should really look for a +draftfolder argument.
    folder=+drafts
  fi
  # Else use the current folder ($folder empty)

  if [[ $folder = +* ]]; then
  # *Edit Me*:  use hard-wired path with + for speed.
    foldpath=~/Mail/$folder[2,-1]
  else
    foldpath=$(mhpath $folder)
  fi

  # Extract all existing message numbers from the folder.
  nums=($foldpath/<->(N:t))
  # If that worked, look for marked sequences.
  # *Edit Me*: if you never use non-standard sequences, comment out
  # or delete the next three lines.
  if (( $#nums )); then
    nums=($nums $(mark $folder | awk -F: '{print $1}'))
  fi

  # *Edit Me*:  `unseen' is the value of Unseen-Sequence, if it exists;
  set -A reply next cur prev first last all unseen $nums

}

mhfile () {
  # Find an MH file; for use with -form arguments and the like.
  # Use with compctl -K mhfile.

  local mhfpath file
  # *Edit Me*:  Array containing all the places MH will look for templates etc.
  mhfpath=(~/Mail /usr/local/lib/MH)

  # Emulate completeinword behaviour as appropriate
  local wordstr
  if [[ -o completeinword ]]; then
    wordstr='$1*$2'
  else
    wordstr='$1$2*'
  fi

  if [[ $1$2 = */* ]]; then
    # path given: don't search MH locations
    eval "reply=($wordstr(.N))"
  else
    # no path:  only search MH locations.
    eval "reply=(\$mhfpath/$wordstr(.N:t))"
  fi
}

# Note: you must type the initial + or @@ of a folder name to get
# completion, even in places where only folder names are allowed.
# Abbreviations for options are not recognised.  Hit tab to complete
# the option name first.
compctl -K mhfseq -x 's[+][@@]' -K mhcomp -S / -q - \
  's[-]' -k "(all fast nofast header noheader help list nolist \
  pack nopack pop push recurse norecurse total nototal)" -- folder
compctl -K mhfseq -x 's[+][@@],c[-1,-draftfolder] s[+][@@]' \
  -K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq - \
  'C[-1,-(editor|whatnowproc)]' -c - \
  's[-]' -k "(draftfolder draftmessage nodraftfolder editor noedit \
  file form use nouse whatnowproc nowhatnowproc help)" - \
  'c[-1,-form]' -K mhfile -- comp
compctl -K mhfseq -x 's[+][@@]' -K mhcomp -S / -q - \
  's[-]' -k "(audit noaudit changecur nochangecur form format \
  file silent nosilent truncate notruncate width help)" - \
  'C[-1,-(audit|form)]' -K mhfile - 'c[-1,file]' -f + -- inc
compctl -K mhfseq -x 's[+][@@]' -K mhcomp -S / -q - \
  's[-]' -k "(sequence add delete list public nopublic zero nozero help)" -- \
  mark
compctl -K mhfseq -x 's[+][@@]' \
  -K mhcomp -S / -q - 'c[-1,-file]' -f - 'c[-1,-rmmprov]' -c - \
  's[-]' -k "(draft link nolink preserve nopreserve src file \
  rmmproc normmproc help)" -- refile
compctl -K mhfseq -x 's[+][@@]' \
  -K mhcomp -S / -q - 'c[-1,-draftmessage]'  -K mhfseq -\
  's[-]' -k "(annotate noannotate cc nocc draftfolder nodraftfolder \
  draftmessage editor noedit fcc filter form inplace noinplace query \
  noquery width whatnowproc nowhatnowproc help)" - 'c[-1,(cc|nocc)]' \
  -k "(all to cc me)" - 'C[-1,-(filter|form)]' -K mhfile - \
  'C[-1,-(editor|whatnowproc)]' -c -- repl
compctl -K mhfseq -x 's[+][@@]' -K mhcomp -S / -q - \
  's[-]' -k "(clear noclear form format header noheader reverse noreverse \
  file help width)" - 'c[-1,-file]' -f - 'c[-1,-form]' -K mhfile -- scan
compctl -K mhfseq -x 's[+][@@]'  -K mhcomp -S / -q - \
  's[-]' -k "(draft header noheader showproc noshowproc)" - \
  'c[-1,showproc]' -c -- show next prev
compctl -K mhfseq -x 's[+][@@]' -K mhcomp -S / -q - 's[-]' \
  -k "(help)" -- rmm
compctl -K mhfseq -x 's[+][@@]' -K mhcomp -S / -q - \
  's[-]' -k "(after before cc date datefield from help list nolist \
  public nopublic search sequence subject to zero nozero not or and \
  lbrace rbrace)" -- pick
compctl -K mhfseq -x 's[+][@@]' -K mhcomp -S / -q - 's[-]' \
  -k "(alias check draft draftfolder draftmessage help nocheck \
  nodraftfolder)" -- whom
#------------------------------------------------------------------------------
# By Bart Schaefer
# CVS -- there's almost no way to make this all-inclusive, but ...
#
cvsflags=(-H -Q -q -r -w -l -n -t -v -b -e -d)
cvscmds=(add admin checkout commit diff history import export log rdiff
	    release remove status tag rtag update)

# diff assumes gnu rcs using gnu diff
# log assumes gnu rcs

compctl -k "($cvscmds $cvsflags)" \
    -x "c[-1,-D]" -k '(today yesterday 1\ week\ ago)' \
    - "r[add,;]" -k "(-k -m)" -f \
    - "r[admin,;]" -K cvstargets \
    - "r[checkout,;]" -k "(-A -N -P -Q -c -f -l -n -p -q -s -r -D -d -k -j)" \
    - "r[commit,;]" -k "(-n -R -l -f -m -r)"  -K cvstargets \
    - "r[diff,;]" -k "(-l -D -r -c -u -b -w)" -K cvstargets \
    - "r[history,;]" \
	-k "(-T -c -o -m -x -a -e -l -w -D -b -f -n -p -r -t -u)" \
	-K cvstargets \
    - "r[history,;] c[-1,-u]" -u \
    - "r[import,;]" -k "(-Q -q -I -b -m)" -f \
    - "r[export,;]" -k "(-N -Q -f -l -n -q -r -D -d)" -f \
    - "R[(r|)log,;]" -k "(-l -R -h -b -t -r -w)" -K cvstargets \
    - 'R[(r|)log,;] s[-w] n[-1,,],s[-w]' -u -S , -q \
    - "r[rdiff,;]" -k "(-Q -f -l -c -u -s -t -D -r -V)" -K cvstargets \
    - "r[release,;]" -k "(-Q -d -q)" -f \
    - "r[remove,;]" -k "(-l -R)" -K cvstargets \
    - "r[status,;]" -k "(-v -l -R)" -K cvstargets \
    - "r[tag,;]" -k "(-Q -l -R -q -d -b)" -K cvstargets \
    - "r[rtag,;]" -k "(-Q -a -f -l -R -n -q -d -b -r -D)" -f \
    - "r[update,;]" -k "(-A -P -Q -d -f -l -R -p -q -k -r -D -j -I)" \
	-K cvstargets \
    -- cvs
unset cvsflags cvscmds

cvstargets() {
    local nword args pref f
    setopt localoptions nullglob
    read -nc nword; read -Ac args
    pref=$args[$nword]
    if [[ -d $pref:h && ! -d $pref ]]
    then
	pref=$pref:h
    elif [[ $pref != */* ]]
    then
	pref=
    fi
    [[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
    if [[ -f ${pref}CVS/Entries ]]
    then
	reply=( "${pref}${^${${(f@@)$(<${pref}CVS/Entries)}#/}%%/*}"
		${pref}*/**/CVS(:h) )
    else
	reply=( ${pref}*/**/CVS(:h) )
    fi
}
#------------------------------------------------------------------------------
# RedHat Linux rpm utility
#
compctl -s '$(rpm -qa)' \
	-x 's[--]' -s 'oldpackage percent replacefiles replacepkgs noscripts
		       root excludedocs includedocs test upgrade test clean
		       short-circuit sign recompile rebuild resign querytags
		       queryformat version help quiet rcfile force hash' - \
	's[ftp:]' -P '//' -s '$(</u/zsh/ftphosts)' -S '/' - \
	'c[-1,--root]' -g '*(-/)' - \
	'c[-1,--rcfile]' -f - \
	'p[1] s[-b]' -k '(p l c i b a)' - \
	'c[-1,--queryformat] N[-1,{]' \
		-s '"${${(f)$(rpm --querytags)}#RPMTAG_}"' -S '}' - \
	'W[1,-q*] C[-1,-([^-]*|)f*]' -f - \
	'W[1,-i*], W[1,-q*] C[-1,-([^-]*|)p*]' \
		-g '*.rpm' + -g '*(-/)' + -f -- rpm
#------------------------------------------------------------------------------
@


2.11
log
@(un)setopt completion example now know about no_option
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.10 1996/07/19 01:48:36 hzoli Exp $
d442 3
a444 2
    if [[ -f "${pref}CVS/Entries" ]] then
	reply=( "${pref}${^${${(f@@)$(< ${pref}CVS/Entries)}#/}%%/*}"
@


2.10
log
@avoid a fork/exec in CVS completion.  From Bart.
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.9 1996/07/15 04:43:21 hzoli Exp $
a41 1
compctl -s '`unsetopt`' setopt
d43 2
a44 1
compctl -s '`setopt 2> /dev/null`' unsetopt
@


2.9
log
@# nothing special related to CVS
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.8 1996/07/15 01:10:22 hzoli Exp $
d443 2
a444 2
    reply=( "${pref}${^${${(f@@)$(cat ${pref}CVS/Entries 2> /dev/null)}#/}%%/*}"
	    ${pref}*/**/CVS(:h) )
d446 1
a446 1
    reply=( ${pref}*/**/CVS(:h) )
@


2.8
log
@CVS compctl improvements from Bart (293, 1639)
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.7 1996/07/01 19:08:35 hzoli Exp $
d442 2
a443 1
    reply=( "${pref}${^${${(f@@)$({<${pref}CVS/Entries} 2>/dev/null)}#/}%%/*}"
d445 3
@


2.7
log
@complete *.rpm files after rpm -i
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.6 1996/07/01 19:07:26 hzoli Exp $
d404 1
a404 1
    -x "c[-1,-D]" -k '(today yesterday 1\\\ week\\\ ago)' \
d442 2
a443 3
    reply=($(for f in $(cat ${pref}CVS/Entries 2>/dev/null | \
    		sed 's/^\/\([^\/]*\).*/\1/'); do echo $pref$f; done)
	   $(echo ${pref}**/CVS(:h) | sed 's/CVS//'))
@


2.6
log
@improved MH completions from Peter (zsh-users 268)
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.5 1996/06/16 18:50:47 hzoli Exp $
d461 2
a462 1
	'W[1,-q*] C[-1,-([^-]*|)p*]' -g '*.rpm' + -g '*(-/)' + -f -- rpm
@


2.5
log
@compctl for the RedHat rpm utility
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.4 1996/06/06 00:31:05 hzoli Exp $
d245 6
a250 2
# Still to do:
# Support for searching for files in standard MH locations.
a251 1
# mhcomp is best autoloaded.  Edit path where indicated.
a258 2
  setopt localoptions nullglob

d263 1
a263 1
# The `...`'s here account for most of the time spent in this function.
d265 2
a266 2
#    mhpath=`mhpath +`
# EDIT ME:  Use a hard wired value here: it's faster.
d269 1
a269 1
    mhpath=`mhpath`
d272 1
a272 4
  reply=($mhpath/$pref*(-/))
# For some reason (?) the above line used to be
# reply="reply=($mhpath/$pref*(-/))"
# eval $reply
d278 42
a319 2
mhfseq() { set -A reply $(mark | awk -F: '{print $1}') \
next cur prev first last all unseen }
d321 29
d351 2
a352 2
  's[-]' -k '(all fast nofast header noheader help list nolist \
  pack nopack pop push recurse norecurse total nototal)' -- folder
d356 11
a366 7
  's[-]' -k '(draftfolder draftmessage nodraftfolder editor noedit \
  file form use nouse whatnowproc nowhatnowproc help)' -- comp
compctl -K mhfseq + -x 's[+][@@]' -K mhcomp -S / -q - \
  's[-]' -k '(audit noaudit changecur nochangecur form format \
  file silent nosilent truncate notruncate width help)' - \
  'C[-1,-(audit|form|file)]' -f -- inc
compctl -K mhfseq -x 's[+][@@],C[-1,-src] s[+][@@]' \
d368 5
a372 5
  's[-]' -k '(draft link nolink preserve nopreserve src file \
  rmmproc normmproc help)' -- refile
compctl -K mhfseq -x 's[+][@@],C[-1,-(draftfolder|fcc)] s[+][@@]' \
  -K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq -\
  's[-]' -k '(annotate noannotate cc nocc draftfolder nodraftfolder \
d374 2
a375 2
  noquery width whatnowproc nowhatnowproc help)' - 'c[-1,(cc|nocc)]' \
  -k '(all to cc me)' - 'C[-1,-(filter|form)]' -f - \
d378 2
a379 2
  's[-]' -k '(clear noclear form format header noheader reverse noreverse \
  file help width)' - 'C[-1,-(file|form)]' -f -- scan
d381 8
a388 2
  's[-]' -k '(draft header noheader showproc noshowproc)' - \
  'c[-1,showproc]' -c -- show
d390 2
a391 1
  -k '(help)' -- rmm
@


2.4
log
@new compctl options: -m for external commands and -w for reserved words.
-cFBmwaRG now only completes enabled commands.  -d, -e documentation fixed.
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.3 1996/05/05 00:32:24 hzoli Exp $
d14 1
a14 1
#-------------------------------------------------------------------------------
d57 1
a57 1
#-------------------------------------------------------------------------------
d62 1
a62 1
#-------------------------------------------------------------------------------
d70 1
a70 1
#-------------------------------------------------------------------------------
d74 1
a74 1
#-------------------------------------------------------------------------------
d77 1
a77 1
#-------------------------------------------------------------------------------
d90 1
a90 1
#-------------------------------------------------------------------------------
d103 1
a103 1
#-------------------------------------------------------------------------------
d107 1
a107 1
#-------------------------------------------------------------------------------
d111 1
a111 1
#-------------------------------------------------------------------------------
d116 1
a116 1
#-------------------------------------------------------------------------------
d120 1
a120 1
#-------------------------------------------------------------------------------
d124 1
a124 1
#-------------------------------------------------------------------------------
d132 1
a132 1
#-------------------------------------------------------------------------------
d141 1
a141 1
#-------------------------------------------------------------------------------
d151 1
a151 1
#-------------------------------------------------------------------------------
d162 1
a162 1
#-------------------------------------------------------------------------------
d176 1
a176 1
#-------------------------------------------------------------------------------
d180 1
a180 1
#-------------------------------------------------------------------------------
d199 1
a199 1
#-------------------------------------------------------------------------------
d220 1
a220 1
#-------------------------------------------------------------------------------
d237 1
a237 1
#-------------------------------------------------------------------------------
d243 1
a243 1
#-------------------------------------------------------------------------------
d314 1
a314 1
#-------------------------------------------------------------------------------
d368 17
a384 2
#-------------------------------------------------------------------------------

@


2.3
log
@use cdmatch2
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.2 1996/05/05 00:24:34 hzoli Exp $
d36 4
a39 2
compctl -e disable
compctl -d enable
d53 3
a55 1
compctl -l '' nohup exec nice eval - time rusage
a56 1
compctl -l '' -x 'p[1]' -B -- builtin
@


2.2
log
@A compctl change as now globbing does not use too much memory
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.1 1996/05/05 00:24:33 hzoli Exp $
d80 7
a86 2
compctl -x 'S[/][~][./][../]' -g '*(-/)' + -g '*(-/D)' - \
	'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
d120 1
a120 1
compctl -g 'RCS/*(:s@@RCS/@@@@:s/\,v//)' co rlog rcs
@


2.1
log
@Revised old competion examples and added some new ones.
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 2.0 1996/05/02 22:57:04 hzoli Exp $
d15 2
a16 1
groups=( $(cut -d: -f1 /etc/group) )
d19 3
a21 3
# It can be done without forking:
# groups=( "${${(f)$(</etc/group)}%%:*}" )
# groups=( "${${(f)$(ypcat groups)}%%:*}" ) # if you use NIS
@


2.0
log
@New maintainer: Zoltn Hidvgi <hzoli@@cs.elte.hu>
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 1.11 1995/09/17 05:50:08 coleman Exp $
d15 7
d37 1
a37 1
compctl -k "(`limit | cut -d' ' -f1`)" limit ulimit
d40 3
a42 1
compctl -s '`setopt`' unsetopt
d59 4
a62 3
compctl -s '$(groups)' newgrp
compctl -f -x 'p[1]' -s '$(groups)' -- chgrp
compctl -f -x 'p[1]' -u -- chown
d106 1
a106 1
compctl -g '*.ps' + -g '*(-/)' gs ghostview psps pstops psmulti psselect
d109 1
a109 1
compctl -g '*.tex*' + -g '*(-/)' tex latex texi2dvi glatex slitex gslitex
d114 1
a114 1
compctl -g 'RCS/*(:t:s/\,v//)' co rlog rcs
d116 5
a120 3
# gzip files, but gzip -d only gzipped or compressed files
compctl -f -x 'R[-*d,^*]' -g '*.gz *.z *.Z' + -g '*(-/)' -- gzip
compctl -g '*.gz *.z *.Z' + -g '*(-/)' gunzip   # zcat if you use GNU
d154 13
a166 11
# Find is very system dependend, this one is for GNU find.
compctl -x 's[-]' -k "(daystart depth follow maxdepth mindepth noleaf version xdev \
   amin anewer cmin cnewer ctime empty false fstype gid group inum links lname mmin \
   mtime name newer nouser nogroup path perm regex size true type uid used user xtype \
   exec fprint fprint0 fprintf ok print print0 printf prune ls)" - \
   'p[1]' -g '. .. *(-/)' - \
   'c[-1,-anewer][-1,-cnewer][-1,-newer][-1,-fprint][-1,fprint0][-1,fprintf]' -f - \
   'c[-1,-fstype]' -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' - \
   'c[-1,-group]' -s '$(groups)' - \
   'c[-1,-user]' -u - \
   'r[-exec,;][-ok,;]' -l '' -- find
d194 1
a194 1
   man_pages=( ${^manpath}/man*/*(N:t:r) )   # Check your setting of SH_WORD_SPLIT
d205 1
a205 1
     reply=( ${^manpath}/man$a[3]/$1*$2(N:t:r) )    # See above
d207 1
a207 1
     reply=( ${^manpath}/man*/$1*$2(N:t:r) )    # See above
d214 8
a221 4
Xcolours() { set -A reply $(awk '{ if (NF < 5) print $4 }' < \
   =(tr '[A-Z]' '[a-z]' < /usr/openwin/lib/X11/rgb.txt)) }
Xcursor() { reply=($(awk '/^#define/ {print $2}' \
   </usr/include/X11/cursorfont.h | sed 's/^XC_//')) }
d229 6
a243 1
  integer ngtrue
d247 1
a247 1
  [[ -o nullglob ]] && ngtrue=1 || setopt nullglob
d262 4
a265 2
  reply="reply=($mhpath/$pref*(-/))"
  eval $reply
a268 2

  (( ngtrue )) || unsetopt nullglob
d343 2
a344 3
    local nword args pref ngtrue f
    [[ -o nullglob ]] && ngtrue=1
    setopt nullglob
a357 1
    [[ $ngtrue = 1 ]] || unsetopt nullglob
@


1.11
log
@improvements in compctls from Zefram.
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 1.10 1995/05/25 09:34:19 coleman Exp coleman $
@


1.10
log
@*** empty log message ***
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 1.9 1995/05/19 08:38:42 coleman Exp $
d11 2
a12 1
# For a detailed description of how these work, check the man page.
d16 3
a18 1
compctl -j -P '%' fg bg wait jobs disown
d21 4
a24 1
compctl -F unfunction
d26 2
a27 1
compctl -v export integer typeset declare readonly unset vared
d30 1
a30 2
compctl -k '(cputime filesize datasize stacksize coredumpsize resident \
   memoryuse memorylocked descriptors openfiles vmemorysize)' limit ulimit
d34 5
d41 1
a41 1
compctl -l '' nohup exec nice eval
d46 3
a48 1
compctl -j -P % -x 's[-] p[1]' -k signals -- kill
d55 1
a55 1
   's[-f],c[-1,-f]' -f -- mail elm
a56 2
compctl -g "*.[cCoa]" -x 's[-I]' -g "*(/)" - \
   's[-l]' -s '${(s.:.)LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' -- cc gcc
d58 1
a58 1
   'c[-1,-f]' -f -- make gmake
d61 1
a61 1
# Rmdir only real directories
d64 2
a65 2
# Cd/pushd only directories or symbolic links to directories
compctl -g '*(-/) cd pushd
d70 1
a70 1
   'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
d78 6
d85 1
a85 1
# Strip, profile, and debug only executables.  The compctls for the
d89 1
a89 1
# Su takes an username and args for the shell.  The `-c' case is
d112 1
a112 1
# Ftp takes hostnames
d136 1
a136 1
   awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'
d140 1
a140 1
   awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'
d154 23
d338 1
@


1.9
log
@*** empty log message ***
@
text
@d1 1
a1 1
# $Id: compctl-examples,v 1.8 1995/05/07 07:14:02 coleman Exp coleman $
d24 1
a24 1
  memoryuse memorylocked descriptors openfiles vmemorysize)' limit ulimit
d42 1
a42 1
  's[-f],c[-1,-f]' -f -- mail elm
d45 1
a45 1
  's[-l]' -s '${(s.:.)LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' -- cc gcc
d47 1
a47 1
  'c[-1,-f]' -f -- make gmake
d59 1
a59 1
	'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
d72 2
a73 2
# su takes an username and args for the shell, the `-c' case is
# handled specially here
d104 2
a105 1
# Default completion.  See func/multicomp
d119 1
a119 1
  awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'
d123 1
a123 1
  awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)'
d125 1
a125 1
# find is very system dependend, this one is for GNU find.
d127 9
a135 9
amin anewer cmin cnewer ctime empty false fstype gid group inum links lname mmin \
mtime name newer nouser nogroup path perm regex size true type uid used user xtype \
exec fprint fprint0 fprintf ok print print0 printf prune ls)" - \
'p[1]' -g '. .. *(-/)' - \
'c[-1,-anewer][-1,-cnewer][-1,-newer][-1,-fprint][-1,fprint0][-1,fprintf]' -f - \
'c[-1,-fstype]' -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' - \
'c[-1,-group]' -s '$(groups)' - \
'c[-1,-user]' -u - \
'r[-exec,;][-ok,;]' -l '' -- find
d140 3
a142 3
  man_pages=( ${^manpath}/man*/*(N:t:r) )   # Check your setting of SH_WORD_SPLIT
  compctl -k man_pages man
  reply=( $man_pages )
d148 7
a154 7
  local a
  read -cA a
  if [[ $a[2] = -s ]] then         # Or [[ $a[2] = [0-9]* ]] for BSD
    reply=( ${^manpath}/man$a[3]/$1*$2(N:t:r) )    # See above
  else
    reply=( ${^manpath}/man*/$1*$2(N:t:r) )    # See above
  fi
d161 1
a161 1
  =(tr '[A-Z]' '[a-z]' < /usr/openwin/lib/X11/rgb.txt)) }
d163 1
a163 1
</usr/include/X11/cursorfont.h | sed 's/^XC_//')) }
d165 5
a169 5
  -grey -rv -solid -name)' -x 'c[-1,-display]' -k hosts -S ':0.0' - \
  'c[-1,-cursor]' -f -  'c[-2,-cursor]' -f - \
  'c[-1,-bitmap]' -g '/usr/include/X11/bitmaps/*' - \
  'c[-1,-cursor_name]' -K Xcursor - \
  'C[-1,-(solid|fg|bg)]' -K Xcolours -- xsetroot
@


1.8
log
@added compctl for make/gmake
@
text
@d1 1
a1 2
#
# $Id: compctl-examples,v 1.7 1995/03/31 21:19:11 coleman Exp coleman $
d13 1
a13 1

d33 1
a33 1

d36 1
a36 2

# Misc.
d43 1
a43 1

d49 1
a49 1

d52 1
a52 1

d60 1
a60 1

d67 1
a67 1

d71 1
a71 1

d75 1
a75 1

d80 1
a80 1

d84 1
a84 1

d88 1
a88 1

d94 1
a94 1

d103 1
a103 1

d112 12
a123 1

d135 1
a135 1

d156 1
a156 1

d169 1
a169 1

d241 1
a241 3

# End of MH completions

@


1.7
log
@*** empty log message ***
@
text
@d2 1
a2 1
# $Id: compctl-examples,v 1.6 1995/03/18 06:21:10 coleman Exp coleman $
d43 3
d48 2
a49 2
compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' - \
  's[-f],c[-1,-f]' -f -- mail elm
@


1.6
log
@*** empty log message ***
@
text
@d2 1
a2 1
# $Id: compctl-examples,v 1.5 1995/03/18 03:56:37 coleman Exp coleman $
d15 2
a16 2
# Completion for some zsh builtins.
compctl -j -P % fg bg wait jobs disown
d21 1
a21 1
compctl -v unset typeset declare vared readonly export integer
d27 2
d31 2
a32 3
# (the one for the trap builtin isn't perfect -- it does not complete
# signal names)
compctl -l '' nohup exec nice eval trap
d35 3
a47 3

# kill takes signal names as the first argument after -, but job names after %
compctl -j -P % -x 's[-] p[1]' -k signals -- kill
@


1.5
log
@*** empty log message ***
@
text
@d2 1
a2 1
# $Id: compctl-examples,v 1.4 1995/03/18 03:47:55 coleman Exp coleman $
a122 13
# xsetroot: gets possible colours, cursors and bitmaps from wherever.
# Uses two auxiliary functions.  You might need to change the path names.
Xcolours() { set -A reply $(awk '{ if (NF < 5) print $4 }' < \
  =(tr '[A-Z]' '[a-z]' < /usr/openwin/lib/X11/rgb.txt)) }
Xcursor() { reply=($(awk '/^#define/ {print $2}' \
</usr/include/X11/cursorfont.h | sed 's/^XC_//')) }
compctl -k '(-help -def -display -cursor -cursor_name -bitmap -mod -fg -bg
  -grey -rv -solid -name)' -x 'c[-1,-display]' -k hosts -S ':0.0' - \
  'c[-1,-cursor]' -f -  'c[-2,-cursor]' -f - \
  'c[-1,-bitmap]' -g '/usr/include/X11/bitmaps/*' - \
  'c[-1,-cursor_name]' -K Xcursor - \
  'C[-1,-(solid|fg|bg)]' -K Xcolours -- xsetroot

d143 13
@


1.4
log
@*** empty log message ***
@
text
@d2 1
a2 1
# $Id$
d4 3
a6 3
# This file gives some examples of compctl commands.  You can either
# put the compctl commands in your .zshrc or include a separate file
# from your .zshrc with the source command.
a40 1
compctl -f -x 'C[-1,*f*] p[2]' -g "*.tar" -- tar
d43 1
@


1.3
log
@*** empty log message ***
@
text
@d1 46
a46 12
# This file gives some examples of compctl commands.
# You can either put the compctl commands in your .zshrc
# or include a separate file from your .zshrc with the
# source command.

# These are just examples, use and modify to personal taste.  Copying this
# file without thought will needlessly increase zsh's memory usage and
# startup time.

# For an explanation of what all this means, read either the
# introduction for some explanation or the manual for a detailed
# description.
d51 15
d70 3
a72 7
# See the func/cdmatch function in the distribution
compctl -x 'S[/][~][./][../]' -g '*(-/)' + -g '*(-/D)' - \
	'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd

# For rcs users, co and rlog from the RCS directory.  We don't want to see
# the RCS and ,v though.
compctl -g 'RCS/*(:t:s/\,v//)' co rlog rcs
d83 3
a85 12
# Anything after nohup is a command by itself with its own completion
# (the one for the trap builtin isn't perfect -- it does not complete
# signal names)
compctl -l '' nohup exec nice eval trap
compctl -l '' -x 'p[1]' -B -- builtin

# If the command is rsh, make the first argument complete to hosts and treat the
# rest of the line as a command on its own.
compctl -k hosts -x 'p[2,-1]' -l '' -- rsh

# kill takes signal names as the first argument after -, but job names after %
compctl -j -P % -x 's[-] p[1]' -k signals -- kill
d93 18
a135 22
# Default completion.  See func/multicomp
compctl -D -f + -U -K multicomp
# If completion of usernames is slow for you, you may want to add something
# like
#    -x 'C[0,*/*]' -f - 's[~]' -S/ -k users + -u
# where `users' contains the names of the users you want to complete often.
# If you want to use this and to be able to complete named directories after
# the `~' you should add `+ -n' at the end


# rlogin takes hosts and users after `-l'
compctl -k hosts -x 'c[-1,-l]' -u -- rlogin

# su takes an username and args for the shell, the `-c' case is
# handled specially here
compctl -u -x 'w[2,-c] p[3,-1]' -l '' -- su

# Some systems have directories containing indices of ftp servers.
# For example: we have the directory /home/ftp/index/INDEX containing
# files of the form `<name>-INDEX.Z', this leads to:
compctl -g '/home/ftp/index/INDEX/*-INDEX.Z(:t:r:s/-INDEX//)' ftp tftp

d144 1
a156 24
# Misc.
compctl -s '$(groups)' newgrp
compctl -f -x 'p[1]' -s '$(groups)' -- chgrp
compctl -f -x 'p[1]' -u -- chown
compctl -g '*.x' + -g '*(-/)' rpcgen
compctl -g "*.[cCoa]" -x 's[-I]' -g "*(/)" - \
  's[-l]' -s '${(s.:.)LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' -- cc gcc
compctl -f -x 'C[-1,*f*] p[2]' -g "*.tar" -- tar
compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' - \
  's[-f],c[-1,-f]' -f -- mail elm

# Some builtins.
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
compctl -k '(cputime filesize datasize stacksize coredumpsize resident \
  memoryuse memorylocked descriptors openfiles vmemorysize)' limit ulimit
compctl -l '' -x 'p[1]' -f -- . source

d286 1
@


1.2
log
@*** empty log message ***
@
text
@d22 2
a23 1
compctl -K cdmatch -S '/' -x 'S[/][~]' -g '*(-/)' -- cd pushd
d107 1
a107 1
  man_pages=( $^manpath/man*/*(N:t:r) )   # Check your setting of SH_WORD_SPLIT
d117 1
a117 1
    reply=( $^manpath/man$a[3]/$1*$2(N:t:r) )    # See above
d119 1
a119 1
    reply=( $^manpath/man*/$1*$2(N:t:r) )    # See above
@


1.1
log
@Initial revision
@
text
@d70 2
a71 1
Xcolours() { reply=($(awk '{ print $4 }' < /usr/lib/X11/X11/rgb.txt)) }
@
