home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / ap / zsh / zsh-2.4 / zsh-2 / zsh-2.4.306 / dots / zcomp next >
Text File  |  1993-10-10  |  3KB  |  74 lines

  1. # This file gives some examples of compctl commands. The name zcomp
  2. # does not mean anything to zsh, you can either put the compctl commands
  3. # in your .zshrc or include a separate file from your .zshrc with the
  4. # source command.
  5.  
  6. # These are just examples, use and modify to personal taste.  Copying this
  7. # file without thought will needlessly increase zsh's memory usage and
  8. # startup time.
  9.  
  10. # For an explanation of what all this means, read either the
  11. # introduction for some explanation or the manual for a detailed
  12. # description.
  13.  
  14. # Rmdir only real directories
  15. compctl -g '*(/)' rmdir
  16.  
  17. # Strip and profile only executables
  18. compctl -g '*(*)' strip gprof
  19.  
  20. # See the func/cdmatch function in the distribution
  21. compctl -K cdmatch -S '/' -x 'S[/][~]' -g '*(-/)' -- cd pushd
  22.  
  23. # For rcs users, co and rlog from the RCS directory.  We don't want to see
  24. # the RCS and ,v though.
  25. compctl -g 'RCS/*(:t:s/\,v//)' co rlog rcs
  26.  
  27. # Run ghostscript on postscript files, but if no postscript file matches what
  28. # we already typed, complete directories as the postscript file may not be in
  29. # the current directory.
  30. compctl -g '*.ps' + -g '*(-/)' gs ghostview
  31.  
  32. # Similar things for tex, texinfo and dvi files.
  33. compctl -g '*.tex*' + -g '*(-/)' tex latex texi2dvi
  34. compctl -g '*.dvi' + -g '*(-/)' xdvi dvips
  35.  
  36. # Anything after nohup is a command by itself with its own completion
  37. compctl -l '' nohup exec
  38.  
  39. # If the command is rsh, make the first argument complete to hosts and treat the
  40. # rest of the line as a command on its own.
  41. compctl -k hosts -x 'p[2,-1]' -l '' -- rsh
  42.  
  43. # kill takes signal names as the first argument after -, but job names after %
  44. compctl -j -P % -x 's[-] p[1]' -k signals -- kill
  45.  
  46. # gzip files, but gzip -d only gzipped or compressed files
  47. compctl -f -x 'R[-*d,^*]' -g '*.gz *.z *.Z' + -g '*(-/)' -- gzip
  48. compctl -g '*.gz *.z *.Z' + -g '*(-/)' gunzip
  49. compctl -g '*.Z' + -g '*(-/)' uncompress
  50.  
  51. # find is very system dependend, this one is for GNU find.
  52. compctl -x 's[-]' -k "(daystart depth follow maxdepth mindepth noleaf version xdev \
  53. amin anewer cmin cnewer ctime empty false fstype gid group inum links lname mmin \
  54. mtime name newer nouser nogroup path perm regex size true type uid used user xtype \
  55. exec fprint fprint0 fprintf ok print print0 printf prune ls)" - \
  56. 'p[1]' -g '. .. *(-/)' - \
  57. 'c[-1,-anewer][-1,-cnewer][-1,-newer][-1,-fprint][-1,fprint0][-1,fprintf]' -f - \
  58. 'r[-exec,;][-ok,;]' -l '' -- find
  59.  
  60. # xsetroot: gets possible colours, cursors and bitmaps from wherever.
  61. # Uses two auxiliary functions.  You might need to change the path names.
  62. Xcolours() { reply=($(awk '{ print $4 }' < /usr/lib/X11/X11/rgb.txt)) }
  63. Xcursor() { reply=($(awk '/^#define/ {print $2}' \
  64. </usr/include/X11/cursorfont.h | sed 's/^XC_//')) }
  65. compctl -k '(-help -def -display -cursor -cursor_name -bitmap -mod -fg -bg
  66.   -grey -rv -solid -name)' -x 'c[-1,-display]' -h -S ':0.0' - \
  67.   'c[-1,-cursor]' -f -  'c[-2,-cursor]' -f - \
  68.   'c[-1,-bitmap]' -g '/usr/include/X11/bitmaps/*' - \
  69.   'c[-1,-cursor_name]' -K Xcursor - \
  70.   'C[-1,-(solid|fg|bg)]' -K Xcolours -- xsetroot
  71.  
  72. # See func/multicomp
  73. compctl -D -f + -U -K multicomp
  74.