home *** CD-ROM | disk | FTP | other *** search
- # This file gives some examples of compctl commands. The name zcomp
- # does not mean anything to zsh, 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.
-
- # Rmdir only real directories
- compctl -g '*(/)' rmdir
-
- # Strip and profile only executables
- compctl -g '*(*)' strip gprof
-
- # See the func/cdmatch function in the distribution
- compctl -K cdmatch -S '/' -x 'S[/][~]' -g '*(-/)' -- 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
-
- # 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 '*.ps' + -g '*(-/)' gs ghostview
-
- # Similar things for tex, texinfo and dvi files.
- compctl -g '*.tex*' + -g '*(-/)' tex latex texi2dvi
- compctl -g '*.dvi' + -g '*(-/)' xdvi dvips
-
- # Anything after nohup is a command by itself with its own completion
- compctl -l '' nohup exec
-
- # 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
-
- # 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
- compctl -g '*.Z' + -g '*(-/)' uncompress
-
- # 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 - \
- 'r[-exec,;][-ok,;]' -l '' -- find
-
- # xsetroot: gets possible colours, cursors and bitmaps from wherever.
- # Uses two auxiliary functions. You might need to change the path names.
- Xcolours() { reply=($(awk '{ print $4 }' < /usr/lib/X11/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]' -h -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
-
- # See func/multicomp
- compctl -D -f + -U -K multicomp
-