home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Unix / Shells / zsh / Source / help / compctl < prev    next >
Encoding:
Text File  |  1993-10-08  |  13.6 KB  |  243 lines

  1.        compctl [ -cfqovbCDAIFpEjBaRGuderzNOZ ] [ -k name ]
  2.               [ -X explanation ] [ -K function ]
  3.               [ -P prefix ] [ -S suffix ]
  4.               [ -g globstring ] [ -s subststring ] [ arg ... ]
  5.               [ -H num pattern ] [ -l cmd ]
  6.        compctl flags + flags + ...
  7.        compctl flags -x pattern flags - ... -- arg ...
  8.               Control the editor's completion behavior  when  one
  9.               of  arg is the current command.  (Note that aliases
  10.               are expanded before this is determined.)  With  the
  11.               -D  flag,  control  default completion behavior for
  12.               commands not assigned any  special  behavior;  with
  13.               -C,  control  completion  when  there is no current
  14.               command.  The remaining options specify the type of
  15.               command  arguments  to  look for during completion.
  16.               If completion is attempted for  a  command  with  a
  17.               pathname  containing  slashes  and no completion is
  18.               found the search is retried with the last  pathname
  19.               component.
  20.  
  21.               -c     Expect command names.
  22.               -f     Expect filenames and filesystem paths.
  23.               -o     Expect option names.
  24.               -v     Expect variable names.
  25.               -b     Expect key binding names.
  26.               -A     Expect array names.
  27.               -I     Expect integer variable names.
  28.               -F     Expect function names.
  29.               -p     Expect parameter names.
  30.               -E     Expect environment variable names.
  31.               -j     Expect  job names (the first word of the job
  32.                      leader's command line, useful with the  kill
  33.                      builtin).
  34.               -r     Expect names of running jobs.
  35.               -z     Expect names of suspended jobs.
  36.               -B     Expect names of builtin commands.
  37.               -a     Expect alias names.
  38.               -R     Expect names of regular aliases.
  39.               -G     Expect names of global aliases.
  40.               -u     Expect user names.
  41.               -d     Expect names of disabled commands.
  42.               -e     Expect  names  of  executable  (and enabled)
  43.                      commands.
  44.               -N     Expect names of scalar parameters.
  45.               -O     Expect names of readonly variables.
  46.               -Z     Expect names of shell special parameters.
  47.               -q     If given together with a suffix (see the  -S
  48.                      flag  below) it makes this suffix be removed
  49.                      if the next character typed is  a  blank  or
  50.                      does  not  insert anything (this is the same
  51.                      rule  as  used  for  the   AUTO_REMOVE_SLASH
  52.                      option).
  53.               -k name
  54.                      Expect  names  taken  from  the  elements of
  55.                      $name.   Alternatively,  the  argument  name
  56.                      itself  may  be  a  set  of space- or comma-
  57.                      separated values in  parentheses,  in  which
  58.                      any  delimiter  may  be escaped with a back-
  59.                      slash.   (Example:  `compctl  -k   "(cputime
  60.                      filesize   datasize  stacksize  coredumpsize
  61.                      resident descriptors)" limit'.)
  62.               -K function
  63.                      Call the given function to get  the  comple-
  64.                      tions.  The function gets two arguments: the
  65.                      prefix and the suffix of the word  on  which
  66.                      completion  is  tried.   The function should
  67.                      set the variable reply to an array  contain-
  68.                      ing the completions (one completion per ele-
  69.                      ment); note that reply should  not  be  made
  70.                      local.   Currently  the  command line is not
  71.                      available to the function; an argument pass-
  72.                      ing mechanism will be added shortly.  (Exam-
  73.                      ple: `function whoson { reply=(`users`);  };
  74.                      compctl   -K  whoson  talk'  completes  only
  75.                      logged-on users  after  `talk'.)  Note  that
  76.                      whoson  must  return  an  array so that just
  77.                      "reply=`users`" is incorrect.
  78.               -X explanation
  79.                      Print the explanation string before the list
  80.                      of  completions.  A  `%n'  in this string is
  81.                      replaced by the number of matches.
  82.               -P prefix
  83.                      The prefix is inserted just before the  com-
  84.                      pleted  string;  any  initial  part  already
  85.                      typed will be completed and the whole prefix
  86.                      ignored  for  completion purposes. (Example:
  87.                      `compctl -j -P "%" kill').
  88.               -S suffix
  89.                      After a unique completion is found the  suf-
  90.                      fix  is inserted after the completed string.
  91.               -g globstring
  92.                      The globstring is  expanded  using  filename
  93.                      globbing;  it should be quoted to protect it
  94.                      from  immediate  expansion.  The   resulting
  95.                      filenames  are taken as the possible comple-
  96.                      tions.   Use  `*(/)'  instead  of  `*/'  for
  97.                      directories.   The fignore special parameter
  98.                      is not used.  More than one pattern  may  be
  99.                      given separated by blanks.
  100.               -s subststring
  101.                      The  substring is split into words and these
  102.                      words are  than  expanded  using  all  shell
  103.                      expansion  mechanisms.  The  resulting words
  104.                      are taken as possible completions. The  fig-
  105.                      nore  special  parameter  is not used.  Note
  106.                      that -g is faster for filenames.
  107.               -H num pattern
  108.                      The possible completions are taken from  the
  109.                      last  num history lines. Only words matching
  110.                      pattern are taken. If num is zero  or  nega-
  111.                      tive  the  whole  history is searched and if
  112.                      pattern is the  empty  string  (or  '*',  of
  113.                      course) all words are taken.
  114.               -l cmd This  option  can  not  be combined with any
  115.                      other option. If it is  given  it  restricts
  116.                      the  range  of  command  line words that are
  117.                      considered to be arguments. By default  this
  118.                      range  contains  all  arguments  without the
  119.                      command string. If  combined  with  extended
  120.                      completion and one of `p[...]', `r[...]', or
  121.                      `R[...]' the  range  is  restricted  to  the
  122.                      arguments  between  the ones that are speci-
  123.                      fied in the brackets.  After  the  range  of
  124.                      arguments  is  determined completion is done
  125.                      in it as if they were arguments to  the  cmd
  126.                      given  with  this  option. If this string is
  127.                      empty the first word in the range  is  taken
  128.                      as  the  command name for which to complete.
  129.                      In this case, if the cursor is in the  first
  130.                      word, command names are completed.  Example:
  131.                      `compctl -x 'r[-exec,;]' -l '' -- find' com-
  132.                      pletes the arguments between `-exec' and the
  133.                      following `;' (or the  end  of  the  command
  134.                      line  if there is no such string) as if they
  135.                      were specifying a command on there own.
  136.               -U     Use the whole list of possible  completions,
  137.                      whether  or not they actually match the word
  138.                      on the command line.  The word typed so  far
  139.                      will be deleted.  This is most useful with a
  140.                      function (-K option), which can examine  the
  141.                      word  via the read builtin's -c and -l flags
  142.                      and use its own  criterion  to  decide  what
  143.                      matches.
  144.               The  second  form  specifies  alternative  options.
  145.               First completion is tried with the  options  before
  146.               the  first `+'. If this produces no matches comple-
  147.               tion is tried with the flags after the `+'  and  so
  148.               on.  If  there are no flags after the last `+' this
  149.               means  that  default  completion  is  tried  if  no
  150.               matches were found.
  151.               The  third  form  specifies extended completion for
  152.               the commands given as arg. Each pattern is examined
  153.               in  turn;  when a match is found, the corresponding
  154.               flags, as described above for  the  ordinary  case,
  155.               are  used  to generate possible completions.  If no
  156.               pattern matches, the flags given before the -x  are
  157.               used.  Note that each pattern should be supplied as
  158.               a single argument and should be quoted  to  prevent
  159.               expansion of metacharacters by the shell. A pattern
  160.               is built of sub-patterns separated  by  commas;  it
  161.               matches  if  at  least  one  of  these sub-patterns
  162.               matches (they are `or'ed'). These sub-patterns  are
  163.               in turn composed of other sub-patterns separated by
  164.               white spaces which match if all of the sub-patterns
  165.               match  (they  are  `and'ed').   An  element  of the
  166.               sub-patterns is of the  form  'c[...][...]',  where
  167.               the  pairs  of brackets may be repeated as often as
  168.               necessary, and matches if any of the sets of brack-
  169.               ets  match (an `or').  These elements may be any of
  170.               the following:
  171.  
  172.                       s[string] ...
  173.                              The pattern matches if  the  current
  174.                              word on the command line starts with
  175.                              one of the strings given  in  brack-
  176.                              ets.   The string is not removed and
  177.                              is not part of the completion.
  178.                       S[string] ...
  179.                              Like s[string]  but  the  string  is
  180.                              part of the completion.
  181.                       p[from,to] ...
  182.                              The pattern matches if the number of
  183.                              the current word is between  one  of
  184.                              the from and to pairs. The comma and
  185.                              to are optional; to defaults to  the
  186.                              same  value as from. The numbers may
  187.                              be negative: -n refers to  the  n'th
  188.                              last word on the line.
  189.                       c[offset,string] ...
  190.                              The  pattern  matches  if one of the
  191.                              strings matches the word  offset  by
  192.                              offset  from  the current word posi-
  193.                              tion.
  194.                       C[offset,pattern] ...
  195.                              This is  like  c  but  uses  pattern
  196.                              matching instead.
  197.                       w[index,string] ...
  198.                              The  pattern  matches if the word in
  199.                              position index is equal to the  cor-
  200.                              responding  string.   Note  that the
  201.                              word  count  is  made  after   alias
  202.                              expansion.
  203.                       W[index,pattern] ...
  204.                              Like  w  but  using pattern matching
  205.                              instead.
  206.                       n[index,string] ...
  207.                              Matches if the current word contains
  208.                              string.  Anything up to the index'th
  209.                              occurrence of this string  will  not
  210.                              be  considered  part  of the comple-
  211.                              tion, but the rest will.
  212.                       N[index,string] ...
  213.                              Like n[index,string] but the  string
  214.                              will  be  taken as a character class
  215.                              (anything up to the index'th  occur-
  216.                              rence  of  any  of the characters in
  217.                              string will not be  considered  part
  218.                              of the completion).
  219.                       m[min,max] ...
  220.                              Matches if the total number of words
  221.                              lies    between    min    and    max
  222.                              (inclusive).
  223.                       r[str1,str2]...
  224.                              Matches  if  the  cursor  is after a
  225.                              word with prefix str1. If  there  is
  226.                              also  a word with prefix str2 on the
  227.                              command line it matches only if  the
  228.                              cursor is before this word.
  229.                       R[str1,str2]...
  230.                              Like  r  but  using pattern matching
  231.                              instead.
  232.  
  233.               Example:
  234.  
  235.                      compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' \
  236.                      - 's[-f],c[-1,-f]' -f -- mail
  237.  
  238.               Complete users by default.   After  a  -f  with  an
  239.               optional space, complete file names; if a + follows
  240.               the -f, whether or not there is a space in between,
  241.               complete  with  the  non-directory part of files in
  242.               the directory ~/Mail.
  243.