1ZSHCOMPSYS(1)               General Commands Manual              ZSHCOMPSYS(1)
2
3
4

NAME

6       zshcompsys - zsh completion system
7

DESCRIPTION

9       This describes the shell code for the `new' completion system, referred
10       to as compsys.  It is written in shell functions based on the  features
11       described in zshcompwid(1).
12
13       The features are contextual, sensitive to the point at which completion
14       is started.  Many completions are already provided.  For this reason, a
15       user  can perform a great many tasks without knowing any details beyond
16       how to initialize the system, which is described below  in  INITIALIZA‐
17       TION.
18
19       The context that decides what completion is to be performed may be
20       ·      an  argument  or option position: these describe the position on
21              the command line at which completion is requested.  For  example
22              `first  argument  to  rmdir,  the  word  being completed names a
23              directory';
24
25
26       ·      a special context, denoting an element in  the  shell's  syntax.
27              For  example  `a  word  in  command  position' or `an array sub‐
28              script'.
29
30
31       A full context specification  contains  other  elements,  as  we  shall
32       describe.
33
34       Besides  commands  names and contexts, the system employs two more con‐
35       cepts, styles and tags.  These provide ways for the user  to  configure
36       the system's behaviour.
37
38       Tags  play  a dual role.  They serve as a classification system for the
39       matches, typically indicating a class of object that the user may  need
40       to  distinguish.  For example, when completing arguments of the ls com‐
41       mand the user may prefer to try files before directories,  so  both  of
42       these are tags.  They also appear as the rightmost element in a context
43       specification.
44
45       Styles modify various operations of the completion system, such as out‐
46       put formatting, but also what kinds of completers are used (and in what
47       order), or which tags are examined.  Styles may  accept  arguments  and
48       are  manipulated  using  the  zstyle  command  described in see zshmod‐
49       ules(1).
50
51       In summary, tags describe what the completion objects  are,  and  style
52       how they are to be completed.  At various points of execution, the com‐
53       pletion system checks what styles and/or tags are defined for the  cur‐
54       rent  context, and uses that to modify its behavior.  The full descrip‐
55       tion of context handling, which determines how tags and other  elements
56       of the context influence the behaviour of styles, is described below in
57       COMPLETION SYSTEM CONFIGURATION.
58
59       When a completion is requested, a dispatcher function  is  called;  see
60       the  description  of  _main_complete  in  the list of control functions
61       below. This dispatcher decides which function should be called to  pro‐
62       duce the completions, and calls it. The result is passed to one or more
63       completers, functions that implement individual completion  strategies:
64       simple  completion, error correction, completion with error correction,
65       menu selection, etc.
66
67       More generally, the shell functions contained in the completion  system
68       are of two types:
69       ·      those beginning `comp' are to be called directly; there are only
70              a few of these;
71
72
73       ·      those beginning `_' are called  by  the  completion  code.   The
74              shell  functions  of this set, which implement completion behav‐
75              iour and may be bound to keystrokes, are referred  to  as  `wid‐
76              gets'.  These proliferate as new completions are required.
77
78

INITIALIZATION

80       If the system was installed completely, it should be enough to call the
81       shell function compinit from your initialization  file;  see  the  next
82       section.   However,  the  function  compinstall can be run by a user to
83       configure various aspects of the completion system.
84
85       Usually, compinstall will insert code into .zshrc, although if that  is
86       not  writable  it will save it in another file and tell you that file's
87       location.  Note that it is up to you to make sure that the lines  added
88       to  .zshrc are actually run; you may, for example, need to move them to
89       an earlier place in the file if .zshrc usually returns early.  So  long
90       as you keep them all together (including the comment lines at the start
91       and finish), you can rerun compinstall and it will correctly locate and
92       modify  these lines.  Note, however, that any code you add to this sec‐
93       tion by hand is likely to be lost if you  rerun  compinstall,  although
94       lines using the command `zstyle' should be gracefully handled.
95
96       The  new  code  will  take effect next time you start the shell, or run
97       .zshrc by hand; there is also an option to make them take effect  imme‐
98       diately.   However,  if  compinstall  has removed definitions, you will
99       need to restart the shell to see the changes.
100
101       To run compinstall you will need to make sure it is in a directory men‐
102       tioned in your fpath parameter, which should already be the case if zsh
103       was properly configured as long as your startup files do not remove the
104       appropriate  directories  from  fpath.   Then  it  must  be  autoloaded
105       (`autoload -U compinstall' is recommended).  You can abort the  instal‐
106       lation any time you are being prompted for information, and your .zshrc
107       will not be altered at all; changes only take place right at  the  end,
108       where you are specifically asked for confirmation.
109
110   Use of compinit
111       This section describes the use of compinit to initialize completion for
112       the current session when called directly; if you have  run  compinstall
113       it will be called automatically from your .zshrc.
114
115       To  initialize  the system, the function compinit should be in a direc‐
116       tory mentioned  in  the  fpath  parameter,  and  should  be  autoloaded
117       (`autoload  -U  compinit'  is  recommended),  and  then  run  simply as
118       `compinit'.  This will define a few utility functions, arrange for  all
119       the necessary shell functions to be autoloaded, and will then re-define
120       all widgets that do completion to use the new system.  If you  use  the
121       menu-select  widget,  which  is  part  of  the zsh/complist module, you
122       should make sure that that module is loaded before the call to compinit
123       so  that  that  widget  is  also re-defined.  If completion styles (see
124       below) are set up  to  perform  expansion  as  well  as  completion  by
125       default,  and the TAB key is bound to expand-or-complete, compinit will
126       rebind it to complete-word; this is necessary to use the  correct  form
127       of expansion.
128
129       Should  you need to use the original completion commands, you can still
130       bind keys to the old widgets by putting a `.' in front  of  the  widget
131       name, e.g. `.expand-or-complete'.
132
133       To speed up the running of compinit, it can be made to produce a dumped
134       configuration that will be read in on future invocations; this  is  the
135       default,  but can be turned off by calling compinit with the option -D.
136       The dumped file is .zcompdump in the  same  directory  as  the  startup
137       files  (i.e.  $ZDOTDIR  or $HOME); alternatively, an explicit file name
138       can be given  by  `compinit  -d  dumpfile'.   The  next  invocation  of
139       compinit  will  read  the dumped file instead of performing a full ini‐
140       tialization.
141
142       If the number of completion files changes, compinit will recognise this
143       and produce a new dump file.  However, if the name of a function or the
144       arguments in the first line of a #compdef function (as described below)
145       change,  it is easiest to delete the dump file by hand so that compinit
146       will re-create it the next time it is run.  The check performed to  see
147       if  there are new functions can be omitted by giving the option -C.  In
148       this case the dump file  will  only  be  created  if  there  isn't  one
149       already.
150
151       The  dumping  is  actually  done by another function, compdump, but you
152       will only need to run this yourself if  you  change  the  configuration
153       (e.g.  using  compdef)  and then want to dump the new one.  The name of
154       the old dumped file will be remembered for this purpose.
155
156       If the parameter _compdir is set, compinit uses it as a directory where
157       completion  functions  can be found; this is only necessary if they are
158       not already in the function search path.
159
160       For security reasons compinit also  checks  if  the  completion  system
161       would  use  files not owned by root or by the current user, or files in
162       directories that are world- or group-writable or that are not owned  by
163       root  or  by the current user.  If such files or directories are found,
164       compinit will ask if the completion system should really be  used.   To
165       avoid  these tests and make all files found be used without asking, use
166       the option -u, and to make compinit silently ignore all insecure  files
167       and  directories  use  the  option  -i.  This security check is skipped
168       entirely when the -C option is given.
169
170       The security check can be retried at any time by running  the  function
171       compaudit.   This  is  the  same check used by compinit, but when it is
172       executed directly any changes to fpath are made local to  the  function
173       so they do not persist.  The directories to be checked may be passed as
174       arguments; if none are given, compaudit uses fpath and _compdir to find
175       completion  system  directories, adding missing ones to fpath as neces‐
176       sary.  To force a check of exactly the directories currently  named  in
177       fpath,  set  _compdir  to  an  empty string before calling compaudit or
178       compinit.
179
180       The function bashcompinit provides compatibility with  bash's  program‐
181       mable  completion system.  When run it will define the functions, comp‐
182       gen and complete which correspond to the bash builtins  with  the  same
183       names.   It  will then be possible to use completion specifications and
184       functions written for bash.
185
186   Autoloaded files
187       The convention for autoloaded functions used in completion is that they
188       start with an underscore; as already mentioned, the fpath/FPATH parame‐
189       ter must contain the directory in which they are stored.   If  zsh  was
190       properly  installed on your system, then fpath/FPATH automatically con‐
191       tains the required directories for the standard functions.
192
193       For incomplete installations, if compinit does not  find  enough  files
194       beginning with an underscore (fewer than twenty) in the search path, it
195       will try to find more by adding the directory _compdir  to  the  search
196       path.  If that directory has a subdirectory named Base, all subdirecto‐
197       ries will be added to the path.  Furthermore, if the subdirectory  Base
198       has  a subdirectory named Core, compinit will add all subdirectories of
199       the subdirectories to the path: this allows the functions to be in  the
200       same format as in the zsh source distribution.
201
202       When  compinit  is  run,  it  searches  all  such  files accessible via
203       fpath/FPATH and reads the first line of each of them.  This line should
204       contain  one  of the tags described below.  Files whose first line does
205       not start with one of these tags are not considered to be part  of  the
206       completion system and will not be treated specially.
207
208       The tags are:
209
210       #compdef name ... [ -{p|P} pattern ... [ -N name ... ] ]
211              The  file  will be made autoloadable and the function defined in
212              it will be called when completing names, each of which is either
213              the name of a command whose arguments are to be completed or one
214              of a number of special contexts in the form -context-  described
215              below.
216
217              Each  name may also be of the form `cmd=service'.  When complet‐
218              ing the command cmd, the function typically behaves  as  if  the
219              command   (or  special  context)  service  was  being  completed
220              instead.  This provides a way of altering the behaviour of func‐
221              tions that can perform many different completions.  It is imple‐
222              mented by setting the parameter $service when calling the  func‐
223              tion;  the  function may choose to interpret this how it wishes,
224              and simpler functions will probably ignore it.
225
226              If the #compdef line contains one of the options -p or  -P,  the
227              words  following are taken to be patterns.  The function will be
228              called when completion is attempted for  a  command  or  context
229              that  matches  one  of  the patterns.  The options -p and -P are
230              used to specify patterns to be tried before or after other  com‐
231              pletions  respectively.  Hence -P may be used to specify default
232              actions.
233
234              The option -N is used after a list following -p or -P; it speci‐
235              fies that remaining words no longer define patterns.  It is pos‐
236              sible to toggle between the three options as many times as  nec‐
237              essary.
238
239       #compdef -k style key-sequence ...
240              This  option  creates  a widget behaving like the builtin widget
241              style and binds it to the  given  key-sequences,  if  any.   The
242              style  must  be  one of the builtin widgets that perform comple‐
243              tion, namely complete-word, delete-char-or-list,  expand-or-com‐
244              plete,  expand-or-complete-prefix,  list-choices, menu-complete,
245              menu-expand-or-complete,  or  reverse-menu-complete.    If   the
246              zsh/complist  module  is  loaded  (see zshmodules(1)) the widget
247              menu-select is also available.
248
249              When one of the key-sequences is typed, the function in the file
250              will  be  invoked to generate the matches.  Note that a key will
251              not be re-bound if it already was (that is, was bound  to  some‐
252              thing  other  than  undefined-key).   The widget created has the
253              same name as the file and can be bound to any other  keys  using
254              bindkey as usual.
255
256       #compdef -K widget-name style key-sequence [ name style seq ... ]
257              This is similar to -k except that only one key-sequence argument
258              may be given for each  widget-name  style  pair.   However,  the
259              entire  set  of three arguments may be repeated with a different
260              set of arguments.  Note in particular that the widget-name  must
261              be  distinct  in  each  set.  If it does not begin with `_' this
262              will be added.  The widget-name should not clash with  the  name
263              of  any existing widget: names based on the name of the function
264              are most useful.  For example,
265
266                     #compdef -K _foo_complete complete-word "^X^C" \
267                       _foo_list list-choices "^X^D"
268
269              (all on one line) defines a widget _foo_complete for completion,
270              bound  to  `^X^C',  and a widget _foo_list for listing, bound to
271              `^X^D'.
272
273       #autoload [ options ]
274              Functions with the #autoload tag are marked for autoloading  but
275              are  not  otherwise treated specially.  Typically they are to be
276              called from within one of the completion functions.  Any options
277              supplied  will  be passed to the autoload builtin; a typical use
278              is +X to force the function to be loaded immediately.  Note that
279              the -U and -z flags are always added implicitly.
280
281       The  #  is part of the tag name and no white space is allowed after it.
282       The #compdef tags use the compdef function described  below;  the  main
283       difference is that the name of the function is supplied implicitly.
284
285       The special contexts for which completion functions can be defined are:
286
287       -array-value-
288              The right hand side of an array-assignment (`name=(...)')
289
290       -brace-parameter-
291              The name of a parameter expansion within braces (`${...}')
292
293       -assign-parameter-
294              The  name of a parameter in an assignment, i.e. on the left hand
295              side of an `='
296
297       -command-
298              A word in command position
299
300       -condition-
301              A word inside a condition (`[[...]]')
302
303       -default-
304              Any word for which no other completion is defined
305
306       -equal-
307              A word beginning with an equals sign
308
309       -first-
310              This is tried before any other completion function.   The  func‐
311              tion  called  may  set the _compskip parameter to one of various
312              values: all: no further completion is attempted; a  string  con‐
313              taining  the substring patterns: no pattern completion functions
314              will be called; a string containing default:  the  function  for
315              the  `-default-'  context  will  not  be  called,  but functions
316              defined for commands will be.
317
318       -math- Inside mathematical contexts, such as `((...))'
319
320       -parameter-
321              The name of a parameter expansion (`$...')
322
323       -redirect-
324              The word after a redirection operator.
325
326       -subscript-
327              The contents of a parameter subscript.
328
329       -tilde-
330              After an initial tilde (`~'), but before the first slash in  the
331              word.
332
333       -value-
334              On the right hand side of an assignment.
335
336       Default  implementations  are  supplied for each of these contexts.  In
337       most cases the context -context-  is  implemented  by  a  corresponding
338       function  _context,  for example the context `-tilde-' and the function
339       `_tilde').
340
341       The contexts -redirect- and -value- allow extra context-specific infor‐
342       mation.  (Internally, this is handled by the functions for each context
343       calling the function _dispatch.)  The extra information is added  sepa‐
344       rated by commas.
345
346       For  the -redirect- context, the extra information is in the form `-re‐
347       direct-,op,command', where op is the redirection operator  and  command
348       is  the name of the command on the line.  If there is no command on the
349       line yet, the command field will be empty.
350
351       For the -value- context, the form is `-value-,name,command', where name
352       is  the  name of the parameter on the left hand side of the assignment.
353       In  the  case  of  elements  of  an  associative  array,  for   example
354       `assoc=(key <TAB>', name is expanded to `name-key'.  In certain special
355       contexts, such as completing after `make  CFLAGS=',  the  command  part
356       gives the name of the command, here make; otherwise it is empty.
357
358       It  is  not necessary to define fully specific completions as the func‐
359       tions provided  will  try  to  generate  completions  by  progressively
360       replacing  the elements with `-default-'.  For example, when completing
361       after `foo=<TAB>', _value will try the names `-value-,foo,'  (note  the
362       empty          command          part),          `-value-,foo,-default-'
363       and`-value-,-default-,-default-', in that order, until it finds a func‐
364       tion to handle the context.
365
366       As an example:
367
368              compdef '_files -g "*.log"' '-redirect-,2>,-default-'
369
370       completes  files matching `*.log' after `2> <TAB>' for any command with
371       no more specific handler defined.
372
373       Also:
374
375              compdef _foo -value-,-default-,-default-
376
377       specifies that _foo provides completions for the values  of  parameters
378       for  which  no special function has been defined.  This is usually han‐
379       dled by the function _value itself.
380
381       The same lookup rules are used when looking  up  styles  (as  described
382       below); for example
383
384              zstyle ':completion:*:*:-redirect-,2>,*:*' file-patterns '*.log'
385
386       is  another  way  to  make  completion  after `2> <TAB>' complete files
387       matching `*.log'.
388
389   Functions
390       The following function  is  defined  by  compinit  and  may  be  called
391       directly.
392
393       compdef [ -ane ] function name ... [ -{p|P} pattern ... [ -N name ...]]
394       compdef -d name ...
395       compdef -k [ -an ] function style key-sequence [ key-sequence ... ]
396       compdef -K [ -an ] function name style key-seq [ name style seq ... ]
397              The  first  form  defines the function to call for completion in
398              the given contexts as described for the #compdef tag above.
399
400              Alternatively, all the arguments may  have  the  form  `cmd=ser‐
401              vice'.   Here  service  should  already  have  been  defined  by
402              `cmd1=service' lines in #compdef files, as described above.  The
403              argument for cmd will be completed in the same way as service.
404
405              The  function  argument may alternatively be a string containing
406              almost any shell code.  If the string contains  an  equal  sign,
407              the  above  will  take precedence.  The option -e may be used to
408              specify the first argument is to be evaluated as shell code even
409              if it contains an equal sign.  The string will be executed using
410              the eval builtin command to generate completions.  This provides
411              a  way  of  avoiding having to define a new completion function.
412              For example, to complete files ending in `.h'  as  arguments  to
413              the command foo:
414
415                     compdef '_files -g "*.h"' foo
416
417              The  option  -n prevents any completions already defined for the
418              command or context from being overwritten.
419
420              The option -d deletes any completion defined for the command  or
421              contexts listed.
422
423              The  names  may  also contain -p, -P and -N options as described
424              for the #compdef tag.  The effect on the argument list is  iden‐
425              tical,  switching  between  definitions  of  patterns tried ini‐
426              tially, patterns tried finally, and  normal  commands  and  con‐
427              texts.
428
429              The  parameter $_compskip may be set by any function defined for
430              a pattern context.  If it is set to a value containing the  sub‐
431              string  `patterns' none of the pattern-functions will be called;
432              if it is set to a value containing the substring `all', no other
433              function  will  be called.  Setting $_compskip in this manner is
434              of particular utility when using the -p option, as otherwise the
435              dispatcher  will  move  on  to  additional functions (likely the
436              default one) after calling the pattern-context  one,  which  can
437              mangle  the  display  of completion possibilities if not handled
438              properly.
439
440              The form with -k defines a widget with  the  same  name  as  the
441              function that will be called for each of the key-sequences; this
442              is like the #compdef -k tag.  The function should  generate  the
443              completions  needed  and  will otherwise behave like the builtin
444              widget whose name is given as the style argument.   The  widgets
445              usable   for   this   are:  complete-word,  delete-char-or-list,
446              expand-or-complete,   expand-or-complete-prefix,   list-choices,
447              menu-complete,  menu-expand-or-complete,  and  reverse-menu-com‐
448              plete, as well as menu-select  if  the  zsh/complist  module  is
449              loaded.   The  option  -n  prevents the key being bound if it is
450              already to bound to something other than undefined-key.
451
452              The form with -K is similar and defines multiple  widgets  based
453              on  the  same  function, each of which requires the set of three
454              arguments name, style and key-sequence, where the latter two are
455              as  for  -k and the first must be a unique widget name beginning
456              with an underscore.
457
458              Wherever applicable, the -a option makes the function  autoload‐
459              able, equivalent to autoload -U function.
460
461       The function compdef can be used to associate existing completion func‐
462       tions with new commands.  For example,
463
464              compdef _pids foo
465
466       uses the function _pids to complete process IDs for the command foo.
467
468       Note also the _gnu_generic function described below, which can be  used
469       to complete options for commands that understand the `--help' option.
470

COMPLETION SYSTEM CONFIGURATION

472       This section gives a short overview of how the completion system works,
473       and then more detail on how users can configure how  and  when  matches
474       are generated.
475
476   Overview
477       When  completion is attempted somewhere on the command line the comple‐
478       tion system begins building the context.  The context represents every‐
479       thing  that  the  shell knows about the meaning of the command line and
480       the significance of the cursor position.  This takes account of a  num‐
481       ber  of things including the command word (such as `grep' or `zsh') and
482       options to which the current word may be an argument (such as the  `-o'
483       option to zsh which takes a shell option as an argument).
484
485       The  context  starts out very generic ("we are beginning a completion")
486       and becomes more specific as more is learned ("the current word is in a
487       position  that is usually a command name" or "the current word might be
488       a variable name" and so on).  Therefore the context  will  vary  during
489       the same call to the completion system.
490
491       This  context information is condensed into a string consisting of mul‐
492       tiple fields separated by colons, referred to simply as  `the  context'
493       in the remainder of the documentation.  Note that a user of the comple‐
494       tion system rarely needs to compose a context string, unless for  exam‐
495       ple  a  new  function  is being written to perform completion for a new
496       command.  What a user may need to do is compose a style pattern,  which
497       is  matched  against a context when needed to look up context-sensitive
498       options that configure the completion system.
499
500       The next few paragraphs explain how a context is  composed  within  the
501       completion  function suite.  Following that is discussion of how styles
502       are defined.  Styles determine such things as how the matches are  gen‐
503       erated,  similarly  to  shell options but with much more control.  They
504       are defined with the zstyle builtin command (see zshmodules(1)).
505
506       The context string always consists of a fixed set of fields,  separated
507       by  colons and with a leading colon before the first.  Fields which are
508       not yet known are left empty, but the surrounding colons appear anyway.
509       The  fields are always in the order :completion:function:completer:com‐
510       mand:argument:tag.  These have the following meaning:
511
512       ·      The literal string completion, saying that this style is used by
513              the  completion  system.   This  distinguishes  the context from
514              those used by, for example, zle widgets and ZFTP functions.
515
516
517       ·      The function, if completion is called from a named widget rather
518              than  through  the  normal completion system.  Typically this is
519              blank, but it is set by special widgets such as  predict-on  and
520              the  various  functions in the Widget directory of the distribu‐
521              tion to the name of that function, often in an abbreviated form.
522
523
524       ·      The completer currently active, the name of the function without
525              the  leading  underscore and with other underscores converted to
526              hyphens.  A `completer' is in overall control of how  completion
527              is  to  be performed; `complete' is the simplest, but other com‐
528              pleters exist to perform related tasks such as correction, or to
529              modify  the  behaviour  of  a  later completer.  See the section
530              `Control Functions' below for more information.
531
532
533       ·      The command or a special -context-, just at it appears following
534              the  #compdef tag or the compdef function.  Completion functions
535              for commands that have sub-commands usually modify this field to
536              contain the name of the command followed by a minus sign and the
537              sub-command.  For example, the completion function for  the  cvs
538              command  sets this field to cvs-add when completing arguments to
539              the add subcommand.
540
541
542       ·      The argument; this indicates which command line or option  argu‐
543              ment  we  are  completing.  For command arguments this generally
544              takes the form argument-n, where n is the number  of  the  argu‐
545              ment, and for arguments to options the form option-opt-n where n
546              is the number of the argument to option opt.  However,  this  is
547              only  the  case  if  the  command  line  is parsed with standard
548              UNIX-style options and arguments, so many completions do not set
549              this.
550
551
552       ·      The tag.  As described previously, tags are used to discriminate
553              between the types of matches a completion function can  generate
554              in  a  certain context.  Any completion function may use any tag
555              name it likes, but a list of  the  more  common  ones  is  given
556              below.
557
558
559       The  context  is  gradually put together as the functions are executed,
560       starting with the main entry point, which  adds  :completion:  and  the
561       function  element  if necessary.  The completer then adds the completer
562       element.  The contextual  completion  adds  the  command  and  argument
563       options.   Finally,  the  tag is added when the types of completion are
564       known.  For example, the context name
565
566              :completion::complete:dvips:option-o-1:files
567
568       says that normal completion was attempted as the first argument to  the
569       option -o of the command dvips:
570
571              dvips -o ...
572
573       and the completion function will generate filenames.
574
575       Usually  completion  will  be  tried  for all possible tags in an order
576       given by the completion function.  However,  this  can  be  altered  by
577       using  the  tag-order style.  Completion is then restricted to the list
578       of given tags in the given order.
579
580       The _complete_help bindable command shows all  the  contexts  and  tags
581       available  for completion at a particular point.  This provides an easy
582       way of finding information for  tag-order  and  other  styles.   It  is
583       described in the section `Bindable Commands' below.
584
585       When  looking  up styles the completion system uses full context names,
586       including the tag.  Looking up the value of a style therefore  consists
587       of two things: the context, which is matched to the most specific (best
588       fitting) style pattern, and the name of the style itself, which must be
589       matched  exactly.   The  following examples demonstrate that style pat‐
590       terns may be loosely defined for  styles  that  apply  broadly,  or  as
591       tightly  defined  as  desired for styles that apply in narrower circum‐
592       stances.
593
594       For example, many completion functions can generate matches in a simple
595       and  a  verbose  form  and  use  the verbose style to decide which form
596       should be used.  To make all such functions use the verbose form, put
597
598              zstyle ':completion:*' verbose yes
599
600       in a startup file (probably .zshrc).  This gives the verbose style  the
601       value  yes  in  every context inside the completion system, unless that
602       context has a more specific definition.  It is best to avoid giving the
603       context  as  `*' in case the style has some meaning outside the comple‐
604       tion system.
605
606       Many such general purpose styles can be configured simply by using  the
607       compinstall function.
608
609       A  more specific example of the use of the verbose style is by the com‐
610       pletion for the kill builtin.  If the style is set, the  builtin  lists
611       full  job  texts and process command lines; otherwise it shows the bare
612       job numbers and PIDs.  To turn the style off for this use only:
613
614              zstyle ':completion:*:*:kill:*:*' verbose no
615
616       For even more control, the style can use one  of  the  tags  `jobs'  or
617       `processes'.  To turn off verbose display only for jobs:
618
619              zstyle ':completion:*:*:kill:*:jobs' verbose no
620
621       The  -e option to zstyle even allows completion function code to appear
622       as the argument to a style; this requires  some  understanding  of  the
623       internals  of completion functions (see see zshcompwid(1))).  For exam‐
624       ple,
625
626              zstyle -e ':completion:*' hosts 'reply=($myhosts)'
627
628       This forces the value of the hosts style to be read from  the  variable
629       myhosts each time a host name is needed; this is useful if the value of
630       myhosts can change dynamically.  For another useful  example,  see  the
631       example in the description of the file-list style below.  This form can
632       be slow and should be avoided for commonly examined styles such as menu
633       and list-rows-first.
634
635       Note  that  the  order in which styles are defined does not matter; the
636       style mechanism uses the most specific possible match for a  particular
637       style to determine the set of values.  More precisely, strings are pre‐
638       ferred over patterns  (for  example,  `:completion::complete:::foo'  is
639       more  specific  than  `:completion::complete:::*'), and longer patterns
640       are preferred over shorter patterns.
641
642       A good rule of thumb is that any completion style pattern that needs to
643       include more than one wildcard (*) and that does not end in a tag name,
644       should include all six  colons  (:),  possibly  surrounding  additional
645       wildcards.
646
647       Style  names like those of tags are arbitrary and depend on the comple‐
648       tion function.  However, the following two sections list  some  of  the
649       most common tags and styles.
650
651   Standard Tags
652       Some  of  the following are only used when looking up particular styles
653       and do not refer to a type of match.
654
655       accounts
656              used to look up the users-hosts style
657
658       all-expansions
659              used by the _expand completer when adding the single string con‐
660              taining all possible expansions
661
662       all-files
663              for  the  names of all files (as distinct from a particular sub‐
664              set, see the globbed-files tag).
665
666       arguments
667              for arguments to a command
668
669       arrays for names of array parameters
670
671       association-keys
672              for keys of associative arrays; used when  completing  inside  a
673              subscript to a parameter of this type
674
675       bookmarks
676              when  completing  bookmarks (e.g. for URLs and the zftp function
677              suite)
678
679       builtins
680              for names of builtin commands
681
682       characters
683              for single characters in arguments of  commands  such  as  stty.
684              Also  used  when  completing  character classes after an opening
685              bracket
686
687       colormapids
688              for X colormap ids
689
690       colors for color names
691
692       commands
693              for names of external commands.  Also used by  complex  commands
694              such as cvs when completing names subcommands.
695
696       contexts
697              for contexts in arguments to the zstyle builtin command
698
699       corrections
700              used  by  the  _approximate and _correct completers for possible
701              corrections
702
703       cursors
704              for cursor names used by X programs
705
706       default
707              used in some contexts to provide a way of  supplying  a  default
708              when  more  specific tags are also valid.  Note that this tag is
709              used when only the function field of the context name is set
710
711       descriptions
712              used when looking up the value of the format style  to  generate
713              descriptions for types of matches
714
715       devices
716              for names of device special files
717
718       directories
719              for  names  of  directories -- local-directories is used instead
720              when completing arguments of cd  and  related  builtin  commands
721              when the cdpath array is set
722
723       directory-stack
724              for entries in the directory stack
725
726       displays
727              for X display names
728
729       domains
730              for network domains
731
732       email-plugin
733              for   email   addresses  from  the  `_email-plugin'  backend  of
734              _email_addresses
735
736       expansions
737              used by the _expand completer for individual words  (as  opposed
738              to  the complete set of expansions) resulting from the expansion
739              of a word on the command line
740
741       extensions
742              for X server extensions
743
744       file-descriptors
745              for numbers of open file descriptors
746
747       files  the generic file-matching tag used by functions completing file‐
748              names
749
750       fonts  for X font names
751
752       fstypes
753              for file system types (e.g. for the mount command)
754
755       functions
756              names of functions -- normally shell functions, although certain
757              commands may understand other kinds of function
758
759       globbed-files
760              for filenames when the name has been generated by pattern match‐
761              ing
762
763       groups for names of user groups
764
765       history-words
766              for words from the history
767
768       hosts  for hostnames
769
770       indexes
771              for array indexes
772
773       jobs   for jobs (as listed by the `jobs' builtin)
774
775       interfaces
776              for network interfaces
777
778       keymaps
779              for names of zsh keymaps
780
781       keysyms
782              for names of X keysyms
783
784       libraries
785              for names of system libraries
786
787       limits for system limits
788
789       local-directories
790              for  names of directories that are subdirectories of the current
791              working directory when completing arguments of  cd  and  related
792              builtin  commands  (compare path-directories) -- when the cdpath
793              array is unset, directories is used instead
794
795       manuals
796              for names of manual pages
797
798       mailboxes
799              for e-mail folders
800
801       maps   for map names (e.g. NIS maps)
802
803       messages
804              used to look up the format style for messages
805
806       modifiers
807              for names of X modifiers
808
809       modules
810              for modules (e.g. zsh modules)
811
812       my-accounts
813              used to look up the users-hosts style
814
815       named-directories
816              for named directories (you wouldn't  have  guessed  that,  would
817              you?)
818
819       names  for all kinds of names
820
821       newsgroups
822              for USENET groups
823
824       nicknames
825              for nicknames of NIS maps
826
827       options
828              for command options
829
830       original
831              used  by  the _approximate, _correct and _expand completers when
832              offering the original string as a match
833
834       other-accounts
835              used to look up the users-hosts style
836
837       other-files
838              for the names of any non-directory files.  This is used  instead
839              of all-files when the list-dirs-first style is in effect.
840
841       packages
842              for packages (e.g. rpm or installed Debian packages)
843
844       parameters
845              for names of parameters
846
847       path-directories
848              for  names  of  directories  found by searching the cdpath array
849              when completing arguments of cd  and  related  builtin  commands
850              (compare local-directories)
851
852       paths  used  to  look  up  the values of the expand, ambiguous and spe‐
853              cial-dirs styles
854
855       pods   for perl pods (documentation files)
856
857       ports  for communication ports
858
859       prefixes
860              for prefixes (like those of a URL)
861
862       printers
863              for print queue names
864
865       processes
866              for process identifiers
867
868       processes-names
869              used to look up the command style when generating the  names  of
870              processes for killall
871
872       sequences
873              for sequences (e.g. mh sequences)
874
875       sessions
876              for sessions in the zftp function suite
877
878       signals
879              for signal names
880
881       strings
882              for  strings  (e.g.  the  replacement strings for the cd builtin
883              command)
884
885       styles for styles used by the zstyle builtin command
886
887       suffixes
888              for filename extensions
889
890       tags   for tags (e.g. rpm tags)
891
892       targets
893              for makefile targets
894
895       time-zones
896              for time zones (e.g. when setting the TZ parameter)
897
898       types  for types of whatever (e.g. address types for the xhost command)
899
900       urls   used to look up the urls and local styles when completing URLs
901
902       users  for usernames
903
904       values for one of a set of values in certain lists
905
906       variant
907              used by _pick_variant to look up the command to run when  deter‐
908              mining what program is installed for a particular command name.
909
910       visuals
911              for X visuals
912
913       warnings
914              used to look up the format style for warnings
915
916       widgets
917              for zsh widget names
918
919       windows
920              for IDs of X windows
921
922       zsh-options
923              for shell options
924
925   Standard Styles
926       Note  that the values of several of these styles represent boolean val‐
927       ues.  Any of the strings `true', `on', `yes', and `1' can be  used  for
928       the  value  `true' and any of the strings `false', `off', `no', and `0'
929       for the value `false'.  The behavior for any other value  is  undefined
930       except  where  explicitly  mentioned.   The default value may be either
931       `true' or `false' if the style is not set.
932
933       Some of these styles are tested first for  every  possible  tag  corre‐
934       sponding to a type of match, and if no style was found, for the default
935       tag.  The most notable styles of this type are  menu,  list-colors  and
936       styles   controlling   completion   listing  such  as  list-packed  and
937       last-prompt.  When tested for the default tag, only the function  field
938       of  the  context will be set so that a style using the default tag will
939       normally be defined along the lines of:
940
941              zstyle ':completion:*:default' menu ...
942
943       accept-exact
944              This is tested for the default tag in addition to the tags valid
945              for  the current context.  If it is set to `true' and any of the
946              trial matches is the same as the string  on  the  command  line,
947              this match will immediately be accepted (even if it would other‐
948              wise be considered ambiguous).
949
950              When completing pathnames (where the tag used is  `paths')  this
951              style accepts any number of patterns as the value in addition to
952              the boolean values.  Pathnames matching one  of  these  patterns
953              will  be  accepted immediately even if the command line contains
954              some more partially typed pathname components and these match no
955              file under the directory accepted.
956
957              This  style  is  also used by the _expand completer to decide if
958              words beginning with a tilde or parameter  expansion  should  be
959              expanded.   For example, if there are parameters foo and foobar,
960              the string `$foo' will only be expanded if accept-exact  is  set
961              to  `true';  otherwise  the completion system will be allowed to
962              complete $foo to $foobar. If the style  is  set  to  `continue',
963              _expand  will  add  the  expansion as a match and the completion
964              system will also be allowed to continue.
965
966       accept-exact-dirs
967              This is used by filename completion.  Unlike accept-exact it  is
968              a  boolean.  By default, filename completion examines all compo‐
969              nents of a path to see if there are completions of  that  compo‐
970              nent,  even if the component matches an existing directory.  For
971              example, when completion after /usr/bin/, the function  examines
972              possible completions to /usr.
973
974              When  this style is `true', any prefix of a path that matches an
975              existing directory is accepted without any attempt  to  complete
976              it  further.  Hence, in the given example, the path /usr/bin/ is
977              accepted immediately and completion tried in that directory.
978
979              This style is also useful when completing after directories that
980              magically  appear  when referenced, such as ZFS .zfs directories
981              or NetApp .snapshot directories.  When  the  style  is  set  the
982              shell  does  not check for the existence of the directory within
983              the parent directory.
984
985              If  you  wish  to  inhibit  this  behaviour  entirely,  set  the
986              path-completion style (see below) to `false'.
987
988       add-space
989              This  style  is  used by the _expand completer.  If it is `true'
990              (the default), a space will be inserted after all words  result‐
991              ing  from  the  expansion,  or  a slash in the case of directory
992              names.  If the value is `file', the completer will  only  add  a
993              space  to  names  of existing files.  Either a boolean `true' or
994              the value `file' may be combined with `subst', in which case the
995              completer  will  not  add  a  space  to words generated from the
996              expansion of a substitution of the form `$(...)' or `${...}'.
997
998              The _prefix completer uses this style as a simple boolean  value
999              to decide if a space should be inserted before the suffix.
1000
1001       ambiguous
1002              This  applies  when  completing non-final components of filename
1003              paths, in other words those with a trailing  slash.   If  it  is
1004              set,  the  cursor  is  left after the first ambiguous component,
1005              even if menu completion is in use.  The style is  always  tested
1006              with the paths tag.
1007
1008       assign-list
1009              When completing after an equals sign that is being treated as an
1010              assignment, the completion system normally  completes  only  one
1011              filename.   In  some cases the value  may be a list of filenames
1012              separated by colons, as with PATH and similar parameters.   This
1013              style  can  be  set  to a list of patterns matching the names of
1014              such parameters.
1015
1016              The default is to complete lists  when  the  word  on  the  line
1017              already contains a colon.
1018
1019       auto-description
1020              If  set,  this style's value will be used as the description for
1021              options that are not described by the completion functions,  but
1022              that  have exactly one argument.  The sequence `%d' in the value
1023              will be replaced by the description for this argument.   Depend‐
1024              ing  on personal preferences, it may be useful to set this style
1025              to something like `specify: %d'.  Note that this  may  not  work
1026              for some commands.
1027
1028       avoid-completer
1029              This  is  used  by  the  _all_matches completer to decide if the
1030              string consisting of all matches should be  added  to  the  list
1031              currently being generated.  Its value is a list of names of com‐
1032              pleters.  If any of these is the name of the completer that gen‐
1033              erated  the  matches  in this completion, the string will not be
1034              added.
1035
1036              The default value for this style is `_expand _old_list  _correct
1037              _approximate',  i.e.  it  contains  the  completers  for which a
1038              string with all matches will almost never be wanted.
1039
1040       cache-path
1041              This style defines the path where  any  cache  files  containing
1042              dumped  completion  data  are  stored.   It  defaults to `$ZDOT‐
1043              DIR/.zcompcache', or  `$HOME/.zcompcache'  if  $ZDOTDIR  is  not
1044              defined.   The  completion  cache  will  not  be used unless the
1045              use-cache style is set.
1046
1047       cache-policy
1048              This style defines the function that will be used  to  determine
1049              whether  a  cache  needs  rebuilding.   See  the  section on the
1050              _cache_invalid function below.
1051
1052       call-command
1053              This style is used in the function for commands such as make and
1054              ant  where calling the command directly to generate matches suf‐
1055              fers problems such as being slow or, as in the case of make  can
1056              potentially  cause actions in the makefile to be executed. If it
1057              is set to `true' the command is called to generate matches.  The
1058              default value of this style is `false'.
1059
1060       command
1061              In  many places, completion functions need to call external com‐
1062              mands to generate the list of completions.  This  style  can  be
1063              used  to override the command that is called in some such cases.
1064              The elements of the value are joined with spaces to form a  com‐
1065              mand  line  to execute.  The value can also start with a hyphen,
1066              in which case the usual command will be added to the  end;  this
1067              is  most  useful  for putting `builtin' or `command' in front to
1068              make sure the appropriate version of a command  is  called,  for
1069              example  to avoid calling a shell function with the same name as
1070              an external command.
1071
1072              As an example, the completion function for process IDs uses this
1073              style with the processes tag to generate the IDs to complete and
1074              the list of processes  to  display  (if  the  verbose  style  is
1075              `true').   The list produced by the command should look like the
1076              output of the ps command.  The first line is not displayed,  but
1077              is searched for the string `PID' (or `pid') to find the position
1078              of the process IDs in the following lines.  If the line does not
1079              contain  `PID', the first numbers in each of the other lines are
1080              taken as the process IDs to complete.
1081
1082              Note that the completion function  generally  has  to  call  the
1083              specified  command  for  each attempt to generate the completion
1084              list.  Hence care should be taken to specify only commands  that
1085              take  a  short  time to run, and in particular to avoid any that
1086              may never terminate.
1087
1088       command-path
1089              This is a list of directories to search  for  commands  to  com‐
1090              plete.   The  default for this style is the value of the special
1091              parameter path.
1092
1093       commands
1094              This is used by the function  completing  sub-commands  for  the
1095              system  initialisation scripts (residing in /etc/init.d or some‐
1096              where not too far away from that).  Its values give the  default
1097              commands to complete for those commands for which the completion
1098              function isn't able to find them out automatically.  The default
1099              for this style are the two strings `start' and `stop'.
1100
1101       complete
1102              This  is  used  by  the _expand_alias function when invoked as a
1103              bindable command.  If set to `true' and the word on the  command
1104              line  is  not the name of an alias, matching alias names will be
1105              completed.
1106
1107       complete-options
1108              This is used by the completer for  cd,  chdir  and  pushd.   For
1109              these  commands a - is used to introduce a directory stack entry
1110              and completion of these  is  far  more  common  than  completing
1111              options.  Hence unless the value of this style is `true' options
1112              will not be completed, even  after  an  initial  -.   If  it  is
1113              `true',  options  will  be  completed  after an initial - unless
1114              there is a preceding -- on the command line.
1115
1116       completer
1117              The strings given as the value of this style provide  the  names
1118              of the completer functions to use. The available completer func‐
1119              tions are described in the section `Control Functions' below.
1120
1121              Each string may be either the name of a completer function or  a
1122              string  of the form `function:name'.  In the first case the com‐
1123              pleter field of the context will contain the name  of  the  com‐
1124              pleter  without the leading underscore and with all other under‐
1125              scores replaced by hyphens.  In the second case the function  is
1126              the  name of the completer to call, but the context will contain
1127              the user-defined name in the completer field of the context.  If
1128              the  name  starts with a hyphen, the string for the context will
1129              be build from the name of the completer function as in the first
1130              case with the name appended to it.  For example:
1131
1132                     zstyle ':completion:*' completer _complete _complete:-foo
1133
1134              Here,  completion  will call the _complete completer twice, once
1135              using `complete' and once using `complete-foo' in the  completer
1136              field  of  the context.  Normally, using the same completer more
1137              than once only makes sense when used with  the  `functions:name'
1138              form, because otherwise the context name will be the same in all
1139              calls to the completer; possible exceptions to this rule are the
1140              _ignored and _prefix completers.
1141
1142              The  default  value for this style is `_complete _ignored': only
1143              completion will be done, first using the ignored-patterns  style
1144              and the $fignore array and then without ignoring matches.
1145
1146       condition
1147              This  style is used by the _list completer function to decide if
1148              insertion of matches  should  be  delayed  unconditionally.  The
1149              default is `true'.
1150
1151       delimiters
1152              This  style is used when adding a delimiter for use with history
1153              modifiers or glob qualifiers that have delimited arguments.   It
1154              is an array of preferred delimiters to add.  Non-special charac‐
1155              ters are preferred as the completion system may otherwise become
1156              confused.   The  default list is :, +, /, -, %.  The list may be
1157              empty to force a delimiter to be typed.
1158
1159       disabled
1160              If this is set to `true', the _expand_alias completer and  bind‐
1161              able  command  will  try  to  expand disabled aliases, too.  The
1162              default is `false'.
1163
1164       domains
1165              A list of names of network domains for completion.  If  this  is
1166              not   set,   domain   names   will   be   taken  from  the  file
1167              /etc/resolv.conf.
1168
1169       environ
1170              The environ style is used when completing for `sudo'.  It is set
1171              to  an  array of `VAR=value' assignments to be exported into the
1172              local environment before the completion for the  target  command
1173              is invoked.
1174              zstyle ':completion:*:sudo::' environ \
1175                PATH="/sbin:/usr/sbin:$PATH" HOME="/root"
1176
1177       expand This  style is used when completing strings consisting of multi‐
1178              ple parts, such as path names.
1179
1180              If one of its values is the string `prefix', the partially typed
1181              word  from  the line will be expanded as far as possible even if
1182              trailing parts cannot be completed.
1183
1184              If one of its values is the string `suffix', matching names  for
1185              components  after  the  first  ambiguous one will also be added.
1186              This means that the resulting string is the longest  unambiguous
1187              string  possible.  However, menu completion can be used to cycle
1188              through all matches.
1189
1190       fake   This style may be set for any completion context.  It  specifies
1191              additional  strings  that  will always be completed in that con‐
1192              text.  The form of each string is `value:description'; the colon
1193              and  description may be omitted, but any literal colons in value
1194              must be quoted with a backslash.  Any  description  provided  is
1195              shown alongside the value in completion listings.
1196
1197              It  is  important to use a sufficiently restrictive context when
1198              specifying fake strings.  Note that the  styles  fake-files  and
1199              fake-parameters  provide  additional  features  when  completing
1200              files or parameters.
1201
1202       fake-always
1203              This works  identically  to  the  fake  style  except  that  the
1204              ignored-patterns style is not applied to it.  This makes it pos‐
1205              sible to override a set of matches  completely  by  setting  the
1206              ignored patterns to `*'.
1207
1208              The  following  shows  a way of supplementing any tag with arbi‐
1209              trary data, but having it behave for  display  purposes  like  a
1210              separate  tag.   In  this  example  we  use  the features of the
1211              tag-order style to divide the  named-directories  tag  into  two
1212              when  performing completion with the standard completer complete
1213              for arguments of cd.  The tag  named-directories-normal  behaves
1214              as  normal,  but the tag named-directories-mine contains a fixed
1215              set of directories.  This has the effect  of  adding  the  match
1216              group `extra directories' with the given completions.
1217
1218                     zstyle ':completion::complete:cd:*' tag-order \
1219                       'named-directories:-mine:extra\ directories
1220                       named-directories:-normal:named\ directories *'
1221                     zstyle ':completion::complete:cd:*:named-directories-mine' \
1222                       fake-always mydir1 mydir2
1223                     zstyle ':completion::complete:cd:*:named-directories-mine' \
1224                       ignored-patterns '*'
1225
1226       fake-files
1227              This style is used when completing files and looked up without a
1228              tag.  Its values are of the form `dir:names...'.  This will  add
1229              the names (strings separated by spaces) as possible matches when
1230              completing in the directory dir, even if no  such  files  really
1231              exist.   The  dir may be a pattern; pattern characters or colons
1232              in dir should be quoted with a backslash to  be  treated  liter‐
1233              ally.
1234
1235              This  can be useful on systems that support special file systems
1236              whose top-level pathnames can not be listed  or  generated  with
1237              glob  patterns (but see accept-exact-dirs for a more general way
1238              of dealing with this problem).  It can also be used for directo‐
1239              ries for which one does not have read permission.
1240
1241              The  pattern  form can be used to add a certain `magic' entry to
1242              all directories on a particular file system.
1243
1244       fake-parameters
1245              This is used by the completion  function  for  parameter  names.
1246              Its values are names of parameters that might not yet be set but
1247              should be completed nonetheless.  Each name may also be followed
1248              by  a  colon  and  a string specifying the type of the parameter
1249              (like `scalar', `array' or `integer').  If the  type  is  given,
1250              the  name  will only be completed if parameters of that type are
1251              required in the particular context.  Names for which no type  is
1252              specified will always be completed.
1253
1254       file-list
1255              This  style  controls whether files completed using the standard
1256              builtin mechanism are to be listed with a long list  similar  to
1257              ls  -l.   Note  that this feature uses the shell module zsh/stat
1258              for file information; this loads the  builtin  stat  which  will
1259              replace any external stat executable.  To avoid this the follow‐
1260              ing code can be included in an initialization file:
1261
1262                     zmodload -i zsh/stat
1263                     disable stat
1264
1265              The style may either be set to a `true' value (or `all'), or one
1266              of  the  values `insert' or `list', indicating that files are to
1267              be listed in long format in all circumstances, or when  attempt‐
1268              ing  to  insert  a file name, or when listing file names without
1269              attempting to insert one.
1270
1271              More generally, the value may be an array of any  of  the  above
1272              values, optionally followed by =num.  If num is present it gives
1273              the maximum number of matches for which long listing style  will
1274              be used.  For example,
1275
1276                     zstyle ':completion:*' file-list list=20 insert=10
1277
1278              specifies  that  long  format will be used when listing up to 20
1279              files or inserting a file with up  to  10  matches  (assuming  a
1280              listing  is to be shown at all, for example on an ambiguous com‐
1281              pletion), else short format will be used.
1282
1283                     zstyle -e ':completion:*' file-list \
1284                            '(( ${+NUMERIC} )) && reply=(true)'
1285
1286              specifies that long format will be used any time a numeric argu‐
1287              ment is supplied, else short format.
1288
1289       file-patterns
1290              This  is used by the standard function for completing filenames,
1291              _files.  If the style is unset up to  three  tags  are  offered,
1292              `globbed-files',`directories'  and `all-files', depending on the
1293              types of files  expected by the caller of _files.  The first two
1294              (`globbed-files'   and   `directories')   are  normally  offered
1295              together to make it easier to complete files in sub-directories.
1296
1297              The file-patterns style provides  alternatives  to  the  default
1298              tags, which are not used.  Its value consists of elements of the
1299              form `pattern:tag'; each string may contain any number  of  such
1300              specifications separated by spaces.
1301
1302              The  pattern  is  a pattern that is to be used to generate file‐
1303              names.  Any occurrence of the sequence `%p' is replaced  by  any
1304              pattern(s) passed by the function calling _files.  Colons in the
1305              pattern must be preceded by a backslash  to  make  them  distin‐
1306              guishable  from the colon before the tag.  If more than one pat‐
1307              tern is needed, the patterns can be given inside  braces,  sepa‐
1308              rated by commas.
1309
1310              The  tags  of all strings in the value will be offered by _files
1311              and used when looking up other styles.  Any  tags  in  the  same
1312              word  will  be  offered at the same time and before later words.
1313              If no `:tag' is given the `files' tag will be used.
1314
1315              The tag may also be followed by an optional second colon  and  a
1316              description, which will be used for the `%d' in the value of the
1317              format style (if that is set) instead of the default description
1318              supplied  by  the completion function.  If the description given
1319              here contains itself a `%d', that is replaced with the  descrip‐
1320              tion supplied by the completion function.
1321
1322              For example, to make the rm command first complete only names of
1323              object files and then the names of all  files  if  there  is  no
1324              matching object file:
1325
1326                     zstyle ':completion:*:*:rm:*:*' file-patterns \
1327                         '*.o:object-files' '%p:all-files'
1328
1329              To alter the default behaviour of file completion -- offer files
1330              matching a pattern and directories on the  first  attempt,  then
1331              all  files -- to offer only matching files on the first attempt,
1332              then directories, and finally all files:
1333
1334                     zstyle ':completion:*' file-patterns \
1335                         '%p:globbed-files' '*(-/):directories' '*:all-files'
1336
1337              This works even  where  there  is  no  special  pattern:  _files
1338              matches  all  files  using the pattern `*' at the first step and
1339              stops when it sees this pattern.  Note also it will never try  a
1340              pattern more than once for a single completion attempt.
1341
1342              During  the execution of completion functions, the EXTENDED_GLOB
1343              option is in effect, so the characters `#',  `~'  and  `^'  have
1344              special meanings in the patterns.
1345
1346       file-sort
1347              The  standard filename completion function uses this style with‐
1348              out a tag to determine  in  which  order  the  names  should  be
1349              listed;  menu  completion  will  cycle  through them in the same
1350              order.  The possible values are: `size' to sort by the  size  of
1351              the  file;  `links'  to sort by the number of links to the file;
1352              `modification' (or `time' or `date') to sort by the last modifi‐
1353              cation  time;  `access'  to  sort  by  the last access time; and
1354              `inode' (or `change') to sort by the last inode change time.  If
1355              the  style is set to any other value, or is unset, files will be
1356              sorted alphabetically by name.  If the value contains the string
1357              `reverse',  sorting is done in the opposite order.  If the value
1358              contains the string `follow', timestamps are associated with the
1359              targets  of symbolic links; the default is to use the timestamps
1360              of the links themselves.
1361
1362       file-split-chars
1363              A set of characters that will cause all file completions for the
1364              given  context to be split at the point where any of the charac‐
1365              ters occurs.  A typical use is to  set  the  style  to  :;  then
1366              everything  up  to and including the last : in the string so far
1367              is  ignored  when  completing   files.    As   this   is   quite
1368              heavy-handed,  it  is  usually  preferable  to update completion
1369              functions for contexts where this behaviour is useful.
1370
1371       filter The   ldap   plugin   of   email   address    completion    (see
1372              _email_addresses)  uses  this style to specify the attributes to
1373              match against when filtering entries.  So for  example,  if  the
1374              style  is set to `sn', matching is done against surnames.  Stan‐
1375              dard LDAP filtering is used so  normal  completion  matching  is
1376              bypassed.  If this style is not set, the LDAP plugin is skipped.
1377              You may also need to set the command style  to  specify  how  to
1378              connect to your LDAP server.
1379
1380       force-list
1381              This forces a list of completions to be shown at any point where
1382              listing is done, even in cases where the list would  usually  be
1383              suppressed.   For  example,  normally  the list is only shown if
1384              there are at least two different matches.  By setting this style
1385              to  `always',  the  list  will always be shown, even if there is
1386              only a single match that  will  immediately  be  accepted.   The
1387              style  may  also be set to a number.  In this case the list will
1388              be shown if there are at least that many matches, even  if  they
1389              would all insert the same string.
1390
1391              This style is tested for the default tag as well as for each tag
1392              valid for the current completion.   Hence  the  listing  can  be
1393              forced only for certain types of match.
1394
1395       format If  this is set for the descriptions tag, its value is used as a
1396              string to  display  above  matches  in  completion  lists.   The
1397              sequence  `%d'  in  this  string  will  be replaced with a short
1398              description of what these matches are.   This  string  may  also
1399              contain  the output attribute sequences understood by compadd -X
1400              (see zshcompwid(1)).
1401
1402              The style is tested with each tag valid for the current  comple‐
1403              tion  before  it is tested for the descriptions tag.  Hence dif‐
1404              ferent format strings can be  defined  for  different  types  of
1405              match.
1406
1407              Note  also  that  some  completer  functions  define  additional
1408              `%'-sequences.  These are described for the completer  functions
1409              that make use of them.
1410
1411              Some  completion  functions  display  messages  that may be cus‐
1412              tomised by setting this style for the messages tag.   Here,  the
1413              `%d'  is  replaced  with a message given by the completion func‐
1414              tion.
1415
1416              Finally, the format string is looked up with the  warnings  tag,
1417              for use when no matches could be generated at all.  In this case
1418              the `%d' is replaced with the descriptions for the matches  that
1419              were  expected  separated  by  spaces.   The  sequence  `%D'  is
1420              replaced with the same descriptions separated by newlines.
1421
1422              It is possible to use printf-style field width  specifiers  with
1423              `%d' and similar escape sequences.  This is handled by the zfor‐
1424              mat builtin command  from  the  zsh/zutil  module,  see  zshmod‐
1425              ules(1).
1426
1427       glob   This  is  used by the _expand completer.  If it is set to `true'
1428              (the default), globbing will be attempted on the words resulting
1429              from  a previous substitution (see the substitute style) or else
1430              the original string from the line.
1431
1432       global If this is set to `true' (the default), the  _expand_alias  com‐
1433              pleter and bindable command will try to expand global aliases.
1434
1435       group-name
1436              The  completion  system  can  group  different types of matches,
1437              which appear in separate lists.  This style can be used to  give
1438              the  names  of groups for particular tags.  For example, in com‐
1439              mand position the completion system generates names  of  builtin
1440              and  external  commands,  names  of aliases, shell functions and
1441              parameters and reserved words as possible completions.  To  have
1442              the external commands and shell functions listed separately:
1443
1444                     zstyle ':completion:*:*:-command-:*:commands' \
1445                            group-name commands
1446                     zstyle ':completion:*:*:-command-:*:functions' \
1447                            group-name functions
1448
1449              As  a consequence, any match with the same tag will be displayed
1450              in the same group.
1451
1452              If the name given is the empty string the name of  the  tag  for
1453              the  matches will be used as the name of the group.  So, to have
1454              all different types of matches  displayed  separately,  one  can
1455              just set:
1456
1457                     zstyle ':completion:*' group-name ''
1458
1459              All  matches for which no group name is defined will be put in a
1460              group named -default-.
1461
1462       group-order
1463              This style is additional to the group-name style to specify  the
1464              order  for  display of the groups defined by that style (compare
1465              tag-order, which determines which completions  appear  at  all).
1466              The  groups named are shown in the given order; any other groups
1467              are shown in the order defined by the completion function.
1468
1469              For example, to have names of builtin commands, shell  functions
1470              and  external  commands  appear in that order when completing in
1471              command position:
1472
1473                     zstyle ':completion:*:*:-command-:*:*' group-order \
1474                            builtins functions commands
1475
1476       groups A list of names of UNIX groups.  If this is not set, group names
1477              are taken from the YP database or the file `/etc/group'.
1478
1479       hidden If this is set to `true', matches for the given context will not
1480              be listed, although any description for the matches set with the
1481              format style will be shown.  If it is set to `all', not even the
1482              description will be displayed.
1483
1484              Note that the matches will still be completed; they are just not
1485              shown in the list.  To avoid having matches considered as possi‐
1486              ble completions at all, the tag-order style can be  modified  as
1487              described below.
1488
1489       hosts  A  list  of names of hosts that should be completed.  If this is
1490              not set, hostnames are taken from the file `/etc/hosts'.
1491
1492       hosts-ports
1493              This style is used by commands that need or accept hostnames and
1494              network  ports.   The strings in the value should be of the form
1495              `host:port'.  Valid ports are  determined  by  the  presence  of
1496              hostnames; multiple ports for the same host may appear.
1497
1498       ignore-line
1499              This  is  tested  for each tag valid for the current completion.
1500              If it is set to `true', none of the words that  are  already  on
1501              the  line  will be considered as possible completions.  If it is
1502              set to `current', the word the cursor is on will not be  consid‐
1503              ered  as  a  possible  completion.  The value `current-shown' is
1504              similar but only applies if the list of completions is currently
1505              shown  on  the screen.  Finally, if the style is set to `other',
1506              all words on the  line  except  for  the  current  one  will  be
1507              excluded from the possible completions.
1508
1509              The  values  `current'  and  `current-shown'  are a bit like the
1510              opposite of the accept-exact style:  only strings  with  missing
1511              characters will be completed.
1512
1513              Note  that you almost certainly don't want to set this to `true'
1514              or `other' for a general context such as `:completion:*'.   This
1515              is because it would disallow completion of, for example, options
1516              multiple times even if  the  command  in  question  accepts  the
1517              option more than once.
1518
1519       ignore-parents
1520              The  style  is  tested  without a tag by the function completing
1521              pathnames in order to determine whether to ignore the  names  of
1522              directories  already  mentioned in the current word, or the name
1523              of the current working directory.  The value must include one or
1524              both of the following strings:
1525
1526              parent The name of any directory whose path is already contained
1527                     in the word on the line is ignored.   For  example,  when
1528                     completing  after  foo/../, the directory foo will not be
1529                     considered a valid completion.
1530
1531              pwd    The name of the current working  directory  will  not  be
1532                     completed;  hence, for example, completion after ../ will
1533                     not use the name of the current directory.
1534
1535              In addition, the value may include one or both of:
1536
1537              ..     Ignore the specified directories only when  the  word  on
1538                     the line contains the substring `../'.
1539
1540              directory
1541                     Ignore  the  specified  directories  only  when  names of
1542                     directories are completed, not when completing  names  of
1543                     files.
1544
1545              Excluded  values  act  in  a  similar  fashion  to values of the
1546              ignored-patterns style, so they can be restored to consideration
1547              by the _ignored completer.
1548
1549       extra-verbose
1550              If  set, the completion listing is more verbose at the cost of a
1551              probable decrease in completion speed.   Completion  performance
1552              will suffer if this style is set to `true'.
1553
1554       ignored-patterns
1555              A  list  of  patterns;  any trial completion matching one of the
1556              patterns will be excluded from consideration.  The _ignored com‐
1557              pleter  can  appear  in  the  list  of completers to restore the
1558              ignored matches.  This is a more  configurable  version  of  the
1559              shell parameter $fignore.
1560
1561              Note  that  the EXTENDED_GLOB option is set during the execution
1562              of completion functions, so the characters `#', `~' and `^' have
1563              special meanings in the patterns.
1564
1565       insert This  style  is  used  by  the  _all_matches completer to decide
1566              whether to  insert  the  list  of  all  matches  unconditionally
1567              instead of adding the list as another match.
1568
1569       insert-ids
1570              When  completing  process  IDs,  for example as arguments to the
1571              kill and wait builtins the name of a command may be converted to
1572              the  appropriate  process ID.  A problem arises when the process
1573              name typed is not unique.  By default (or if this style  is  set
1574              explicitly  to `menu') the name will be converted immediately to
1575              a set of possible IDs, and menu completion will  be  started  to
1576              cycle through them.
1577
1578              If the value of the style is `single', the shell will wait until
1579              the user has typed enough to make the command unique before con‐
1580              verting the name to an ID; attempts at completion will be unsuc‐
1581              cessful until that point.  If the value  is  any  other  string,
1582              menu  completion  will  be  started when the string typed by the
1583              user is longer than the common prefix to the corresponding IDs.
1584
1585       insert-tab
1586              If this is set to `true', the completion system  will  insert  a
1587              TAB  character  (assuming  that  was  used  to start completion)
1588              instead of performing completion  when  there  is  no  non-blank
1589              character  to  the left of the cursor.  If it is set to `false',
1590              completion will be done even there.
1591
1592              The value may also contain the substrings  `pending'  or  `pend‐
1593              ing=val'.   In  this  case, the typed character will be inserted
1594              instead of starting completion when there is  unprocessed  input
1595              pending.   If  a  val  is  given, completion will not be done if
1596              there are at least that many characters  of  unprocessed  input.
1597              This  is  often  useful when pasting characters into a terminal.
1598              Note however, that it relies on the $PENDING  special  parameter
1599              from  the zsh/zle module being set properly which is not guaran‐
1600              teed on all platforms.
1601
1602              The default value of this style is `true' except for  completion
1603              within vared builtin command where it is `false'.
1604
1605       insert-unambiguous
1606              This  is  used by the _match and _approximate completers.  These
1607              completers are often used with menu completion  since  the  word
1608              typed may bear little resemblance to the final completion.  How‐
1609              ever, if this style is `true', the  completer  will  start  menu
1610              completion  only  if it could find no unambiguous initial string
1611              at least as long as the original string typed by the user.
1612
1613              In the case of the _approximate completer, the  completer  field
1614              in  the context will already have been set to one of correct-num
1615              or approximate-num, where num is the number of errors that  were
1616              accepted.
1617
1618              In  the  case of the _match completer, the style may also be set
1619              to the string `pattern'.  Then the pattern on the line  is  left
1620              unchanged if it does not match unambiguously.
1621
1622       gain-privileges
1623              If set to true, this style enables the use of commands like sudo
1624              or doas to gain extra privileges when retrieving information for
1625              completion.  This  is  only  done  when  a  command such as sudo
1626              appears on the command-line. To force the use of, e.g.  sudo  or
1627              to  override  any  prefix that might be added due to gain-privi‐
1628              leges, the command style can be used with a  value  that  begins
1629              with a hyphen.
1630
1631       keep-prefix
1632              This  style  is used by the _expand completer.  If it is `true',
1633              the completer will try to keep a prefix containing  a  tilde  or
1634              parameter  expansion.   Hence,  for  example,  the string `~/f*'
1635              would be expanded to `~/foo' instead  of  `/home/user/foo'.   If
1636              the  style  is  set  to `changed' (the default), the prefix will
1637              only be left unchanged if there were other changes  between  the
1638              expanded words and the original word from the command line.  Any
1639              other value forces the prefix to be expanded unconditionally.
1640
1641              The behaviour of _expand when this style is `true' is  to  cause
1642              _expand  to  give  up  when a single expansion with the restored
1643              prefix is the same as the original;  hence  any  remaining  com‐
1644              pleters may be called.
1645
1646       last-prompt
1647              This  is  a more flexible form of the ALWAYS_LAST_PROMPT option.
1648              If it is `true', the completion system will try  to  return  the
1649              cursor  to  the previous command line after displaying a comple‐
1650              tion list.  It is tested for all tags valid for the current com‐
1651              pletion, then the default tag.  The cursor will be moved back to
1652              the previous line if this style  is  `true'  for  all  types  of
1653              match.   Note  that unlike the ALWAYS_LAST_PROMPT option this is
1654              independent of the numeric argument.
1655
1656       known-hosts-files
1657              This style should contain a list of files  to  search  for  host
1658              names  and (if the use-ip style is set) IP addresses in a format
1659              compatible with ssh known_hosts files.  If it is  not  set,  the
1660              files /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts are used.
1661
1662       list   This  style  is used by the _history_complete_word bindable com‐
1663              mand.  If it is set to `true' it has no effect.  If it is set to
1664              `false'  matches will not be listed.  This overrides the setting
1665              of the options  controlling  listing  behaviour,  in  particular
1666              AUTO_LIST.   The  context  always  starts with `:completion:his‐
1667              tory-words'.
1668
1669       list-colors
1670              If the zsh/complist module is loaded, this style can be used  to
1671              set  color  specifications.   This mechanism replaces the use of
1672              the ZLS_COLORS and ZLS_COLOURS parameters described in the  sec‐
1673              tion  `The zsh/complist Module' in zshmodules(1), but the syntax
1674              is the same.
1675
1676              If this style is set for the default tag,  the  strings  in  the
1677              value  are  taken  as  specifications that are to be used every‐
1678              where.  If it is set for other tags, the specifications are used
1679              only  for matches of the type described by the tag.  For this to
1680              work best, the group-name style must be set to an empty string.
1681
1682              In addition to setting styles for specific tags, it is also pos‐
1683              sible  to use group names specified explicitly by the group-name
1684              tag together with the `(group)' syntax allowed by the ZLS_COLORS
1685              and ZLS_COLOURS parameters and simply using the default tag.
1686
1687              It  is  possible  to use any color specifications already set up
1688              for the GNU version of the ls command:
1689
1690                     zstyle ':completion:*:default' list-colors \
1691                            ${(s.:.)LS_COLORS}
1692
1693              The default colors are the same as for the GNU  ls  command  and
1694              can  be  obtained  by setting the style to an empty string (i.e.
1695              '').
1696
1697       list-dirs-first
1698              This is used by file completion.  If set, directories to be com‐
1699              pleted  are  listed  separately  from  and before completion for
1700              other files, regardless of tag ordering.  In addition,  the  tag
1701              other-files  is  used  in  place  of all-files for the remaining
1702              files, to indicate that no directories are presented  with  that
1703              tag.
1704
1705       list-grouped
1706              If  this  style  is  `true' (the default), the completion system
1707              will try to make certain completion  listings  more  compact  by
1708              grouping  matches.   For example, options for commands that have
1709              the same description (shown when the verbose  style  is  set  to
1710              `true')  will appear as a single entry.  However, menu selection
1711              can be used to cycle through all the matches.
1712
1713       list-packed
1714              This is tested for each tag valid in the current context as well
1715              as  the  default tag.  If it is set to `true', the corresponding
1716              matches appear in listings as if  the  LIST_PACKED  option  were
1717              set.  If it is set to `false', they are listed normally.
1718
1719       list-prompt
1720              If  this style is set for the default tag, completion lists that
1721              don't fit on the screen can be scrolled (see the description  of
1722              the  zsh/complist  module  in zshmodules(1)).  The value, if not
1723              the empty string, will be displayed after  every  screenful  and
1724              the  shell  will  prompt for a key press; if the style is set to
1725              the empty string, a default prompt will be used.
1726
1727              The value may contain the escape sequences: `%l' or `%L',  which
1728              will  be  replaced  by the number of the last line displayed and
1729              the total number of lines; `%m' or `%M', the number of the  last
1730              match  shown and the total number of matches; and `%p' and `%P',
1731              `Top' when at the beginning of the list, `Bottom'  when  at  the
1732              end  and  the position shown as a percentage of the total length
1733              otherwise.  In each case the form with the uppercase letter will
1734              be  replaced  by  a  string of fixed width, padded to the  right
1735              with spaces, while the lowercase form  will  be  replaced  by  a
1736              variable  width  string.  As in other prompt strings, the escape
1737              sequences `%S', `%s', `%B', `%b', `%U', `%u'  for  entering  and
1738              leaving  the  display  modes  standout,  bold and underline, and
1739              `%F', `%f', `%K', `%k' for changing  the  foreground  background
1740              colour, are also available, as is the form `%{...%}' for enclos‐
1741              ing escape sequences which display with zero (or, with a numeric
1742              argument, some other) width.
1743
1744              After  deleting  this  prompt  the variable LISTPROMPT should be
1745              unset for the removal to take effect.
1746
1747       list-rows-first
1748              This style is tested in the same way as  the  list-packed  style
1749              and  determines whether matches are to be listed in a rows-first
1750              fashion as if the LIST_ROWS_FIRST option were set.
1751
1752       list-suffixes
1753              This style is used by the function that completes filenames.  If
1754              it is `true', and completion is attempted on a string containing
1755              multiple partially typed pathname components, all ambiguous com‐
1756              ponents will be shown.  Otherwise, completion stops at the first
1757              ambiguous component.
1758
1759       list-separator
1760              The value of this style is used in completion listing  to  sepa‐
1761              rate  the  string  to  complete from a description when possible
1762              (e.g. when  completing  options).   It  defaults  to  `--'  (two
1763              hyphens).
1764
1765       local  This  is for use with functions that complete URLs for which the
1766              corresponding files are available directly from the file system.
1767              Its  value should consist of three strings: a hostname, the path
1768              to the default web pages for the server, and the directory  name
1769              used by a user placing web pages within their home area.
1770
1771              For example:
1772
1773                     zstyle ':completion:*' local toast \
1774                         /var/http/public/toast public_html
1775
1776              Completion  after  `http://toast/stuff/'  will look for files in
1777              the directory  /var/http/public/toast/stuff,   while  completion
1778              after  `http://toast/~yousir/' will look for files in the direc‐
1779              tory ~yousir/public_html.
1780
1781       mail-directory
1782              If set, zsh will assume that mailbox files can be found  in  the
1783              directory specified.  It defaults to `~/Mail'.
1784
1785       match-original
1786              This  is  used  by  the _match completer.  If it is set to only,
1787              _match will try to generate matches without inserting a  `*'  at
1788              the  cursor  position.   If set to any other non-empty value, it
1789              will first try to generate matches without inserting the `*' and
1790              if  that  yields  no  matches,  it  will  try again with the `*'
1791              inserted.  If it is unset or set to the empty  string,  matching
1792              will only be performed with the `*' inserted.
1793
1794       matcher
1795              This  style  is tested separately for each tag valid in the cur‐
1796              rent context.  Its value is placed before any  match  specifica‐
1797              tions  given  by the matcher-list style so can override them via
1798              the use of an x: specification.  The value should be in the form
1799              described  in  the section `Completion Matching Control' in zsh‐
1800              compwid(1).  For examples of this, see the  description  of  the
1801              tag-order style.
1802
1803              For  notes comparing the use of this and the matcher-list style,
1804              see under the description of the tag-order style.
1805
1806       matcher-list
1807              This style can be set to a list of match specifications that are
1808              to  be applied everywhere. Match specifications are described in
1809              the section `Completion Matching Control' in zshcompwid(1).  The
1810              completion  system will try them one after another for each com‐
1811              pleter selected.  For example, to try  first  simple  completion
1812              and, if that generates no matches, case-insensitive completion:
1813
1814                     zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
1815
1816              By  default  each  specification replaces the previous one; how‐
1817              ever, if a specification is prefixed with +, it is added to  the
1818              existing list.  Hence it is possible to create increasingly gen‐
1819              eral specifications without repetition:
1820
1821                     zstyle ':completion:*' matcher-list \
1822                            '' '+m:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
1823
1824              It is possible to create match specifications valid for particu‐
1825              lar  completers  by  using the third field of the context.  This
1826              applies  only   to   completers   that   override   the   global
1827              matcher-list, which as of this writing includes only _prefix and
1828              _ignored.  For example, to  use  the  completers  _complete  and
1829              _prefix  but  allow  case-insensitive completion only with _com‐
1830              plete:
1831
1832                     zstyle ':completion:*' completer _complete _prefix
1833                     zstyle ':completion:*:complete:*:*:*' matcher-list \
1834                            '' 'm:{a-zA-Z}={A-Za-z}'
1835
1836              User-defined names, as explained for the  completer  style,  are
1837              available.   This  makes  it  possible to try the same completer
1838              more than once with different match  specifications  each  time.
1839              For example, to try normal completion without a match specifica‐
1840              tion, then normal  completion  with  case-insensitive  matching,
1841              then correction, and finally partial-word completion:
1842
1843                     zstyle ':completion:*' completer \
1844                         _complete _correct _complete:foo
1845                     zstyle ':completion:*:complete:*:*:*' matcher-list \
1846                         '' 'm:{a-zA-Z}={A-Za-z}'
1847                     zstyle ':completion:*:foo:*:*:*' matcher-list \
1848                         'm:{a-zA-Z}={A-Za-z} r:|[-_./]=* r:|=*'
1849
1850              If  the  style is unset in any context no match specification is
1851              applied.  Note also that some completers such  as  _correct  and
1852              _approximate  do not use the match specifications at all, though
1853              these completers will only ever  be  called  once  even  if  the
1854              matcher-list contains more than one element.
1855
1856              Where  multiple  specifications are useful, note that the entire
1857              completion is done for each element of matcher-list,  which  can
1858              quickly  reduce  the  shell's  performance.   As a rough rule of
1859              thumb, one to three strings will  give  acceptable  performance.
1860              On  the other hand, putting multiple space-separated values into
1861              the same string does not have an appreciable impact  on  perfor‐
1862              mance.
1863
1864              If  there  is  no current matcher or it is empty, and the option
1865              NO_CASE_GLOB is in effect, the matching for files  is  performed
1866              case-insensitively  in  any  case.   However,  any  matcher must
1867              explicitly  specify  case-insensitive  matching   if   that   is
1868              required.
1869
1870              For  notes  comparing the use of this and the matcher style, see
1871              under the description of the tag-order style.
1872
1873       max-errors
1874              This is used by the _approximate and  _correct  completer  func‐
1875              tions  to  determine the maximum number of errors to allow.  The
1876              completer will try to generate completions by first allowing one
1877              error,  then  two  errors,  and  so  on, until either a match or
1878              matches were found or the maximum number of errors given by this
1879              style has been reached.
1880
1881              If  the  value for this style contains the string `numeric', the
1882              completer function will take any numeric argument as the maximum
1883              number of errors allowed. For example, with
1884
1885                     zstyle ':completion:*:approximate:::' max-errors 2 numeric
1886
1887              two errors are allowed if no numeric argument is given, but with
1888              a numeric argument of six (as in `ESC-6 TAB'), up to six  errors
1889              are  accepted.  Hence with a value of `0 numeric', no correcting
1890              completion will be attempted unless a numeric argument is given.
1891
1892              If the value contains the string  `not-numeric',  the  completer
1893              will  not  try  to  generate  corrected completions when given a
1894              numeric argument, so in this case the  number  given  should  be
1895              greater  than zero.  For example, `2 not-numeric' specifies that
1896              correcting completion with two errors will usually be performed,
1897              but  if  a numeric argument is given, correcting completion will
1898              not be performed.
1899
1900              The default value for this style is `2 numeric'.
1901
1902       max-matches-width
1903              This style is used to determine the trade off between the  width
1904              of  the  display  used  for matches and the width used for their
1905              descriptions when the verbose style is  in  effect.   The  value
1906              gives  the number of display columns to reserve for the matches.
1907              The default is half the width of the screen.
1908
1909              This has the most impact when  several  matches  have  the  same
1910              description  and  so  will  be grouped together.  Increasing the
1911              style will allow more matches to be grouped together; decreasing
1912              it will allow more of the description to be visible.
1913
1914       menu   If  this is `true' in the context of any of the tags defined for
1915              the current completion menu completion will be used.  The  value
1916              for  a  specific  tag  will  take  precedence  over that for the
1917              `default' tag.
1918
1919              If none of the values found in this way is `true' but  at  least
1920              one  is  set  to  `auto',  the shell behaves as if the AUTO_MENU
1921              option is set.
1922
1923              If one of the values is explicitly set to `false', menu  comple‐
1924              tion will be explicitly turned off, overriding the MENU_COMPLETE
1925              option and other settings.
1926
1927              In the form `yes=num', where `yes' may be any of the `true' val‐
1928              ues  (`yes',  `true',  `on'  and  `1'),  menu completion will be
1929              turned on if there are  at  least  num  matches.   In  the  form
1930              `yes=long',  menu  completion will be turned on if the list does
1931              not fit on the screen.  This does not activate  menu  completion
1932              if  the widget normally only lists completions, but menu comple‐
1933              tion  can  be  activated   in   that   case   with   the   value
1934              `yes=long-list'   (Typically,   the   value   `select=long-list'
1935              described later is more  useful  as  it  provides  control  over
1936              scrolling.)
1937
1938              Similarly,  with any of the `false' values (as in `no=10'), menu
1939              completion will not be used if there are num or more matches.
1940
1941              The value of this widget also controls menu selection, as imple‐
1942              mented  by  the  zsh/complist  module.  The following values may
1943              appear either alongside or instead of the values above.
1944
1945              If the value contains the string `select', menu  selection  will
1946              be started unconditionally.
1947
1948              In the form `select=num', menu selection will only be started if
1949              there are at least num matches.  If the values for more than one
1950              tag provide a number, the smallest number is taken.
1951
1952              Menu  selection can be turned off explicitly by defining a value
1953              containing the string`no-select'.
1954
1955              It is also possible to start menu selection only if the list  of
1956              matches   does  not  fit  on  the  screen  by  using  the  value
1957              `select=long'.  To start menu selection even if the current wid‐
1958              get only performs listing, use the value `select=long-list'.
1959
1960              To  turn  on  menu completion or menu selection when there are a
1961              certain number of matches or the list of matches does not fit on
1962              the  screen,  both  of  `yes=' and `select=' may be given twice,
1963              once with a number and once with `long' or `long-list'.
1964
1965              Finally, it is possible to activate two special  modes  of  menu
1966              selection.   The word `interactive' in the value causes interac‐
1967              tive mode to be  entered  immediately  when  menu  selection  is
1968              started;  see the description of the zsh/complist module in zsh‐
1969              modules(1) for a description of interactive mode.  Including the
1970              string  `search'  does the same for incremental search mode.  To
1971              select  backward  incremental   search,   include   the   string
1972              `search-backward'.
1973
1974       muttrc If  set,  gives the location of the mutt configuration file.  It
1975              defaults to `~/.muttrc'.
1976
1977       numbers
1978              This is used with the jobs tag.  If it is `true', the shell will
1979              complete  job numbers instead of the shortest unambiguous prefix
1980              of the job command text.  If the value is a number, job  numbers
1981              will  only  be used if that many words from the job descriptions
1982              are required to resolve ambiguities.  For example, if the  value
1983              is  `1',  strings  will  only  be used if all jobs differ in the
1984              first word on their command lines.
1985
1986       old-list
1987              This is used by  the  _oldlist  completer.   If  it  is  set  to
1988              `always',  then  standard  widgets  which  perform  listing will
1989              retain the current list of matches, however they were generated;
1990              this can be turned off explicitly with the value `never', giving
1991              the behaviour without the _oldlist completer.  If the  style  is
1992              unset, or any other value, then the existing list of completions
1993              is displayed if it is not already; otherwise, the standard  com‐
1994              pletion  list  is  generated;  this  is the default behaviour of
1995              _oldlist.  However, if there is an old list and this style  con‐
1996              tains  the  name  of  the  completer function that generated the
1997              list, then the old list will be used even if it was generated by
1998              a widget which does not do listing.
1999
2000              For  example, suppose you type ^Xc to use the _correct_word wid‐
2001              get, which generates a list of corrections for  the  word  under
2002              the  cursor.   Usually, typing ^D would generate a standard list
2003              of completions for the word on the command line, and show  that.
2004              With  _oldlist,  it  will  instead  show the list of corrections
2005              already generated.
2006
2007              As another example  consider  the  _match  completer:  with  the
2008              insert-unambiguous  style set to `true' it inserts only a common
2009              prefix string, if there is any.  However, this may remove  parts
2010              of  the  original pattern, so that further completion could pro‐
2011              duce more matches than on  the  first  attempt.   By  using  the
2012              _oldlist completer and setting this style to _match, the list of
2013              matches generated on the first attempt will be used again.
2014
2015       old-matches
2016              This is used by the _all_matches completer to decide if  an  old
2017              list  of matches should be used if one exists.  This is selected
2018              by one of the `true' values or by the  string  `only'.   If  the
2019              value  is  `only',  _all_matches  will  only use an old list and
2020              won't have any effect on the list  of  matches  currently  being
2021              generated.
2022
2023              If  this  style  is  set  it  is  generally  unwise  to call the
2024              _all_matches completer unconditionally.  One possible use is for
2025              either  this style or the completer style to be defined with the
2026              -e option to zstyle to make the style conditional.
2027
2028       old-menu
2029              This is used by the _oldlist completer.  It  controls  how  menu
2030              completion  behaves  when a completion has already been inserted
2031              and the user types a standard completion key such as  TAB.   The
2032              default  behaviour  of  _oldlist  is that menu completion always
2033              continues with the existing list of completions.  If this  style
2034              is  set  to `false', however, a new completion is started if the
2035              old list was generated by a different completion  command;  this
2036              is the behaviour without the _oldlist completer.
2037
2038              For  example, suppose you type ^Xc to generate a list of correc‐
2039              tions, and menu completion is started in one of the usual  ways.
2040              Usually,  or  with this style set to `false', typing TAB at this
2041              point would start trying to complete the line as it now appears.
2042              With _oldlist, it instead continues to cycle through the list of
2043              corrections.
2044
2045       original
2046              This is used by the  _approximate  and  _correct  completers  to
2047              decide if the original string should be added as a possible com‐
2048              pletion.  Normally, this is done only if there are at least  two
2049              possible  corrections, but if this style is set to `true', it is
2050              always added.  Note that the style will  be  examined  with  the
2051              completer  field  in  the  context  name  set  to correct-num or
2052              approximate-num, where num is the number  of  errors  that  were
2053              accepted.
2054
2055       packageset
2056              This  style  is  used  when  completing  arguments of the Debian
2057              `dpkg' program.  It contains an override for the default package
2058              set for a given context.  For example,
2059
2060                     zstyle ':completion:*:complete:dpkg:option--status-1:*' \
2061                                    packageset avail
2062
2063              causes  available packages, rather than only installed packages,
2064              to be completed for `dpkg --status'.
2065
2066       path   The function that completes color names uses this style with the
2067              colors tag.  The value should be the pathname of a file contain‐
2068              ing color names in the format of an X11 rgb.txt  file.   If  the
2069              style  is not set but this file is found in one of various stan‐
2070              dard locations it will be used as the default.
2071
2072       path-completion
2073              This is used by filename completion.  By default, filename  com‐
2074              pletion  examines  all  components of a path to see if there are
2075              completions of that component.  For example, /u/b/z can be  com‐
2076              pleted  to  /usr/bin/zsh.   Explicitly  setting  this  style  to
2077              `false' inhibits this behaviour for path components up to the  /
2078              before    the    cursor;   this   overrides   the   setting   of
2079              accept-exact-dirs.
2080
2081              Even with the style set to `false', it is still possible to com‐
2082              plete  multiple paths by setting the option COMPLETE_IN_WORD and
2083              moving the cursor back to the first component in the path to  be
2084              completed.  For example, /u/b/z can be completed to /usr/bin/zsh
2085              if the cursor is after the /u.
2086
2087       pine-directory
2088              If set, specifies the directory containing PINE  mailbox  files.
2089              There  is no default, since recursively searching this directory
2090              is inconvenient for anyone who doesn't use PINE.
2091
2092       ports  A list of Internet service names (network  ports)  to  complete.
2093              If  this  is  not  set,  service  names  are taken from the file
2094              `/etc/services'.
2095
2096       prefix-hidden
2097              This is used for certain completions which share a  common  pre‐
2098              fix,  for  example command options beginning with dashes.  If it
2099              is `true', the prefix will not be shown in the list of matches.
2100
2101              The default value for this style is `false'.
2102
2103       prefix-needed
2104              This style is also relevant for matches with  a  common  prefix.
2105              If  it  is set to `true' this common prefix must be typed by the
2106              user to generate the matches.
2107
2108              The style is applicable to the  options,  signals,  jobs,  func‐
2109              tions, and parameters completion tags.
2110
2111              For  command  options,  this means that the initial `-', `+', or
2112              `--' must be typed explicitly before option names will  be  com‐
2113              pleted.
2114
2115              For signals, an initial `-' is required before signal names will
2116              be completed.
2117
2118              For jobs, an initial `%' is required before job  names  will  be
2119              completed.
2120
2121              For  function  and  parameter  names,  an  initial `_' or `.' is
2122              required before function or parameter names starting with  those
2123              characters will be completed.
2124
2125              The  default  value  for  this style is `false' for function and
2126              parameter completions, and  `true' otherwise.
2127
2128       preserve-prefix
2129              This style is used when completing path names.  Its value should
2130              be  a pattern matching an initial prefix of the word to complete
2131              that should be left  unchanged  under  all  circumstances.   For
2132              example,  on  some  Unices  an initial `//' (double slash) has a
2133              special meaning; setting this style to the string `//' will pre‐
2134              serve it.  As another example, setting this style to `?:/' under
2135              Cygwin would allow completion after `a:/...' and so on.
2136
2137       range  This is used by the _history  completer  and  the  _history_com‐
2138              plete_word bindable command to decide which words should be com‐
2139              pleted.
2140
2141              If it is a single number, only the last N words from the history
2142              will be completed.
2143
2144              If  it  is a range of the form `max:slice', the last slice words
2145              will be completed; then if that yields  no  matches,  the  slice
2146              words  before those will be tried and so on.  This process stops
2147              either when at least one match has been found, or max words have
2148              been tried.
2149
2150              The default is to complete all words from the history at once.
2151
2152       recursive-files
2153              If  this  style  is set, its value is an array of patterns to be
2154              tested against `$PWD/': note the trailing  slash,  which  allows
2155              directories  in  the  pattern  to  be delimited unambiguously by
2156              including slashes on both sides.  If an ordinary file completion
2157              fails  and  the  word  on  the  command line does not yet have a
2158              directory part to its name, the style  is  retrieved  using  the
2159              same tag as for the completion just attempted, then the elements
2160              tested against $PWD/ in turn.  If one matches,  then  the  shell
2161              reattempts completion by prepending the word on the command line
2162              with each directory in the expansion of **/*(/) in turn.   Typi‐
2163              cally the elements of the style will be set to restrict the num‐
2164              ber of directories beneath the current one to a manageable  num‐
2165              ber, for example `*/.git/*'.
2166
2167              For example,
2168
2169                     zstyle ':completion:*' recursive-files '*/zsh/*'
2170
2171              If  the  current  directory is /home/pws/zsh/Src, then zle_trTAB
2172              can be completed to Zle/zle_tricky.c.
2173
2174       regular
2175              This style is used by the _expand_alias completer  and  bindable
2176              command.   If  set to `true' (the default), regular aliases will
2177              be expanded but only in command  position.   If  it  is  set  to
2178              `false',  regular aliases will never be expanded.   If it is set
2179              to `always', regular aliases will be expanded  even  if  not  in
2180              command position.
2181
2182       rehash If  this  is set when completing external commands, the internal
2183              list (hash) of commands will be updated for each search by issu‐
2184              ing the rehash command.  There is a speed penalty for this which
2185              is only likely to be noticeable when  directories  in  the  path
2186              have slow file access.
2187
2188       remote-access
2189              If  set to `false', certain commands will be prevented from mak‐
2190              ing Internet connections to retrieve remote  information.   This
2191              includes the completion for the CVS command.
2192
2193              It  is not always possible to know if connections are in fact to
2194              a remote site, so some may be prevented unnecessarily.
2195
2196       remove-all-dups
2197              The _history_complete_word bindable  command  and  the  _history
2198              completer  use this to decide if all duplicate matches should be
2199              removed, rather than just consecutive duplicates.
2200
2201       select-prompt
2202              If this is set for the default tag, its value will be  displayed
2203              during  menu  selection (see the menu style above) when the com‐
2204              pletion list does not fit on the screen as a  whole.   The  same
2205              escapes as for the list-prompt style are understood, except that
2206              the numbers refer to the match  or  line  the  mark  is  on.   A
2207              default prompt is used when the value is the empty string.
2208
2209       select-scroll
2210              This  style  is  tested for the default tag and determines how a
2211              completion list is scrolled during a  menu  selection  (see  the
2212              menu  style  above) when the completion list does not fit on the
2213              screen as a whole.  If the value is  `0'  (zero),  the  list  is
2214              scrolled  by  half-screenfuls;  if it is a positive integer, the
2215              list is scrolled by the given number of lines; if it is a  nega‐
2216              tive number, the list is scrolled by a screenful minus the abso‐
2217              lute value of the given number of  lines.   The  default  is  to
2218              scroll by single lines.
2219
2220       separate-sections
2221              This style is used with the manuals tag when completing names of
2222              manual pages.  If it is `true', entries for  different  sections
2223              are  added  separately  using  tag names of the form `manual.X',
2224              where X is the section number.  When  the  group-name  style  is
2225              also  in effect, pages from different sections will appear sepa‐
2226              rately.  This style is also used similarly with the words  style
2227              when completing words for the dict command. It allows words from
2228              different dictionary databases  to  be  added  separately.   The
2229              default for this style is `false'.
2230
2231       show-ambiguity
2232              If  the zsh/complist module is loaded, this style can be used to
2233              highlight the first ambiguous character in completion lists. The
2234              value  is  either  a color indication such as those supported by
2235              the list-colors style or, with a value of `true', a  default  of
2236              underlining is selected. The highlighting is only applied if the
2237              completion display strings correspond to the actual matches.
2238
2239       show-completer
2240              Tested whenever a new completer is tried.  If it is `true',  the
2241              completion system outputs a progress message in the listing area
2242              showing what completer is being  tried.   The  message  will  be
2243              overwritten  by  any  output  when  completions are found and is
2244              removed after completion is finished.
2245
2246       single-ignored
2247              This is used by the _ignored completer when there  is  only  one
2248              match.   If  its  value is `show', the single match will be dis‐
2249              played but not inserted.  If the value is `menu', then the  sin‐
2250              gle  match and the original string are both added as matches and
2251              menu completion is started, making it easy to select  either  of
2252              them.
2253
2254       sort   This allows the standard ordering of matches to be overridden.
2255
2256              If  its  value  is `true' or `false', sorting is enabled or dis‐
2257              abled.  Additionally the values associated with the `-o'  option
2258              to  compadd can also be listed: match, nosort, numeric, reverse.
2259              If it is not set for the context, the standard behaviour of  the
2260              calling widget is used.
2261
2262              The style is tested first against the full context including the
2263              tag, and if that fails to produce a value  against  the  context
2264              without the tag.
2265
2266              In  many  cases where a calling widget explicitly selects a par‐
2267              ticular ordering in lieu of the default, a value  of  `true'  is
2268              not  honoured.   An example of where this is not the case is for
2269              command history where the default of sorting matches chronologi‐
2270              cally may be overridden by setting the style to `true'.
2271
2272              In the _expand completer, if it is set to `true', the expansions
2273              generated will always be sorted.  If it is set to  `menu',  then
2274              the  expansions  are only sorted when they are offered as single
2275              strings but not in the string  containing  all  possible  expan‐
2276              sions.
2277
2278       special-dirs
2279              Normally,  the  completion  code  will not produce the directory
2280              names `.' and `..' as possible completions.  If  this  style  is
2281              set to `true', it will add both `.' and `..' as possible comple‐
2282              tions; if it is set to `..', only `..' will be added.
2283
2284              The following example sets special-dirs to `..' when the current
2285              prefix  is  empty,  is  a single `.', or consists only of a path
2286              beginning with `../'.  Otherwise the value is `false'.
2287
2288                     zstyle -e ':completion:*' special-dirs \
2289                        '[[ $PREFIX = (../)#(|.|..) ]] && reply=(..)'
2290
2291       squeeze-slashes
2292              If set to `true', sequences of slashes in  filename  paths  (for
2293              example  in `foo//bar') will be treated as a single slash.  This
2294              is the usual behaviour of UNIX paths.  However, by  default  the
2295              file  completion function behaves as if there were a `*' between
2296              the slashes.
2297
2298       stop   If set to `true', the  _history_complete_word  bindable  command
2299              will  stop  once  when reaching the beginning or end of the his‐
2300              tory.  Invoking _history_complete_word will then wrap around  to
2301              the  opposite  end  of  the  history.   If  this style is set to
2302              `false' (the default), _history_complete_word will loop  immedi‐
2303              ately as in a menu completion.
2304
2305       strip-comments
2306              If  set  to `true', this style causes non-essential comment text
2307              to be removed from completion matches.   Currently  it  is  only
2308              used  when completing e-mail addresses where it removes any dis‐
2309              play name  from  the  addresses,  cutting  them  down  to  plain
2310              user@host form.
2311
2312       subst-globs-only
2313              This  is used by the _expand completer.  If it is set to `true',
2314              the expansion will only be used if it  resulted  from  globbing;
2315              hence,  if  expansions  resulted  from the use of the substitute
2316              style described below, but these were  not  further  changed  by
2317              globbing, the expansions will be rejected.
2318
2319              The default for this style is `false'.
2320
2321       substitute
2322              This  boolean  style controls whether the _expand completer will
2323              first try to expand all substitutions in  the  string  (such  as
2324              `$(...)' and `${...}').
2325
2326              The default is `true'.
2327
2328       suffix This  is used by the _expand completer if the word starts with a
2329              tilde or contains a  parameter  expansion.   If  it  is  set  to
2330              `true', the word will only be expanded if it doesn't have a suf‐
2331              fix, i.e. if it is something like `~foo' or `$foo'  rather  than
2332              `~foo/'  or `$foo/bar', unless that suffix itself contains char‐
2333              acters eligible for expansion.  The default for  this  style  is
2334              `true'.
2335
2336       tag-order
2337              This  provides a mechanism for sorting how the tags available in
2338              a particular context will be used.
2339
2340              The values for the style are sets of  space-separated  lists  of
2341              tags.  The tags in each value will be tried at the same time; if
2342              no match is found, the next value is used.  (See  the  file-pat‐
2343              terns style for an exception to this behavior.)
2344
2345              For example:
2346
2347                     zstyle ':completion:*:complete:-command-:*:*' tag-order \
2348                         'commands functions'
2349
2350              specifies  that  completion  in  command  position  first offers
2351              external commands and shell functions.  Remaining tags  will  be
2352              tried if no completions are found.
2353
2354              In  addition to tag names, each string in the value may take one
2355              of the following forms:
2356
2357              -      If any value consists of only a  hyphen,  then  only  the
2358                     tags  specified  in the other values are generated.  Nor‐
2359                     mally all tags not explicitly selected are tried last  if
2360                     the  specified  tags  fail to generate any matches.  This
2361                     means that a single value consisting  only  of  a  single
2362                     hyphen turns off completion.
2363
2364              ! tags...
2365                     A  string  starting  with  an  exclamation mark specifies
2366                     names of tags that are not to be used.  The effect is the
2367                     same  as  if  all other possible tags for the context had
2368                     been listed.
2369
2370              tag:label ...
2371                     Here, tag is one of the standard tags  and  label  is  an
2372                     arbitrary  name.  Matches are generated as normal but the
2373                     name label is used in contexts instead of tag.   This  is
2374                     not useful in words starting with !.
2375
2376                     If  the  label starts with a hyphen, the tag is prepended
2377                     to the label to form the name used for lookup.  This  can
2378                     be  used  to make the completion system try a certain tag
2379                     more than once, supplying different  style  settings  for
2380                     each attempt; see below for an example.
2381
2382              tag:label:description
2383                     As  before,  but description will replace the `%d' in the
2384                     value of the format style instead of the default descrip‐
2385                     tion  supplied by the completion function.  Spaces in the
2386                     description must be quoted  with  a  backslash.   A  `%d'
2387                     appearing in description is replaced with the description
2388                     given by the completion function.
2389
2390              In any of the forms above the tag may be a  pattern  or  several
2391              patterns  in the form `{pat1,pat2...}'.  In this case all match‐
2392              ing tags will be used except for any  given  explicitly  in  the
2393              same string.
2394
2395              One use of these features is to try one tag more than once, set‐
2396              ting other styles differently on each attempt, but still to  use
2397              all the other tags without having to repeat them all.  For exam‐
2398              ple, to make completion of function names  in  command  position
2399              ignore  all the completion functions starting with an underscore
2400              the first time completion is tried:
2401
2402                     zstyle ':completion:*:*:-command-:*:*' tag-order \
2403                         'functions:-non-comp *' functions
2404                     zstyle ':completion:*:functions-non-comp' \
2405                         ignored-patterns '_*'
2406
2407              On the first attempt, all tags will be offered but the functions
2408              tag  will  be  replaced by functions-non-comp.  The ignored-pat‐
2409              terns style is set for this tag to  exclude  functions  starting
2410              with  an  underscore.  If there are no matches, the second value
2411              of the tag-order style is used which completes  functions  using
2412              the  default  tag,  this  time presumably including all function
2413              names.
2414
2415              The matches for one tag can be split into different groups.  For
2416              example:
2417
2418                     zstyle ':completion:*' tag-order \
2419                         'options:-long:long\ options
2420                          options:-short:short\ options
2421                          options:-single-letter:single\ letter\ options'
2422                     zstyle ':completion:*:options-long' \
2423                          ignored-patterns '[-+](|-|[^-]*)'
2424                     zstyle ':completion:*:options-short' \
2425                          ignored-patterns '--*' '[-+]?'
2426                     zstyle ':completion:*:options-single-letter' \
2427                          ignored-patterns '???*'
2428
2429              With  the  group-names  style  set, options beginning with `--',
2430              options beginning with a single `-' or `+' but containing multi‐
2431              ple  characters,  and single-letter options will be displayed in
2432              separate groups with different descriptions.
2433
2434              Another use of patterns is to try multiple match  specifications
2435              one after another.  The matcher-list style offers something sim‐
2436              ilar, but it is tested very early in the completion  system  and
2437              hence  can't  be  set  for single commands nor for more specific
2438              contexts.  Here is how to  try  normal  completion  without  any
2439              match specification and, if that generates no matches, try again
2440              with case-insensitive matching, restricting the effect to  argu‐
2441              ments of the command foo:
2442
2443                     zstyle ':completion:*:*:foo:*:*' tag-order '*' '*:-case'
2444                     zstyle ':completion:*-case' matcher 'm:{a-z}={A-Z}'
2445
2446              First,  all the tags offered when completing after foo are tried
2447              using the normal tag name.  If that generates  no  matches,  the
2448              second  value  of  tag-order is used, which tries all tags again
2449              except that this time each has -case appended to  its  name  for
2450              lookup  of  styles.   Hence  this time the value for the matcher
2451              style from the second call to zstyle in the example is  used  to
2452              make completion case-insensitive.
2453
2454              It  is  possible to use the -e option of the zstyle builtin com‐
2455              mand to specify conditions for the use of particular tags.   For
2456              example:
2457
2458                     zstyle -e '*:-command-:*' tag-order '
2459                         if [[ -n $PREFIX$SUFFIX ]]; then
2460                           reply=( )
2461                         else
2462                           reply=( - )
2463                         fi'
2464
2465              Completion  in  command  position  will be attempted only if the
2466              string typed so far is not empty.  This is tested using the PRE‐
2467              FIX  special  parameter;  see  zshcompwid  for  a description of
2468              parameters which are special inside completion widgets.  Setting
2469              reply to an empty array provides the default behaviour of trying
2470              all tags at once; setting it  to  an  array  containing  only  a
2471              hyphen  disables  the  use  of all tags and hence of all comple‐
2472              tions.
2473
2474              If no tag-order style  has  been  defined  for  a  context,  the
2475              strings  `(|*-)argument-*  (|*-)option-*  values'  and `options'
2476              plus all tags offered by the completion function will be used to
2477              provide  a  sensible  default  behavior  that  causes  arguments
2478              (whether normal command arguments or arguments of options) to be
2479              completed before option names for most commands.
2480
2481       urls   This  is used together with the urls tag by functions completing
2482              URLs.
2483
2484              If the value consists of more than one string, or  if  the  only
2485              string  does  not name a file or directory, the strings are used
2486              as the URLs to complete.
2487
2488              If the value contains only one string which is  the  name  of  a
2489              normal  file  the  URLs are taken from that file (where the URLs
2490              may be separated by white space or newlines).
2491
2492              Finally, if the only string in the value names a directory,  the
2493              directory  hierarchy  rooted at this directory gives the comple‐
2494              tions.  The top  level  directory  should  be  the  file  access
2495              method,  such  as  `http', `ftp', `bookmark' and so on.  In many
2496              cases the next level of directories will  be  a  filename.   The
2497              directory hierarchy can descend as deep as necessary.
2498
2499              For example,
2500
2501                     zstyle ':completion:*' urls ~/.urls
2502                     mkdir -p ~/.urls/ftp/ftp.zsh.org/pub
2503
2504              allows   completion   of   all   the   components   of  the  URL
2505              ftp://ftp.zsh.org/pub after suitable commands such as `netscape'
2506              or  `lynx'.   Note,  however,  that access methods and files are
2507              completed separately, so if the hosts style is set hosts can  be
2508              completed without reference to the urls style.
2509
2510              See the description in the function _urls itself for more infor‐
2511              mation (e.g. `more $^fpath/_urls(N)').
2512
2513       use-cache
2514              If this is set, the completion caching layer  is  activated  for
2515              any   completions   which   use   it   (via   the  _store_cache,
2516              _retrieve_cache, and _cache_invalid functions).   The  directory
2517              containing  the  cache  files can be changed with the cache-path
2518              style.
2519
2520       use-compctl
2521              If this style is set to a string not equal to false, 0, no,  and
2522              off, the completion system may use any completion specifications
2523              defined with the compctl  builtin  command.   If  the  style  is
2524              unset,  this  is  done only if the zsh/compctl module is loaded.
2525              The string may also contain the substring `first' to use comple‐
2526              tions  defined with `compctl -T', and the substring `default' to
2527              use the completion defined with `compctl -D'.
2528
2529              Note that this is only intended to smooth  the  transition  from
2530              compctl  to  the  new completion system and may disappear in the
2531              future.
2532
2533              Note also that the definitions from compctl will only be used if
2534              there  is  no  specific  completion  function for the command in
2535              question.  For example, if there is a function _foo to  complete
2536              arguments  to the command foo, compctl will never be invoked for
2537              foo.  However, the compctl version will be  tried  if  foo  only
2538              uses default completion.
2539
2540       use-ip By default, the function _hosts that completes host names strips
2541              IP addresses from entries read from host databases such  as  NIS
2542              and  ssh  files.   If this style is `true', the corresponding IP
2543              addresses can be completed as well.  This style is  not  use  in
2544              any  context  where the hosts style is set; note also it must be
2545              set before the cache of host names is generated  (typically  the
2546              first completion attempt).
2547
2548       users  This  may  be set to a list of usernames to be completed.  If it
2549              is not set all usernames will be completed.  Note that if it  is
2550              set  only  that list of users will be completed; this is because
2551              on some systems querying all users can take a prohibitive amount
2552              of time.
2553
2554       users-hosts
2555              The  values  of  this style should be of the form `user@host' or
2556              `user:host'. It is used for commands that need  pairs  of  user-
2557              and hostnames.  These commands will complete usernames from this
2558              style (only), and will restrict subsequent  hostname  completion
2559              to  hosts  paired  with  that  user  in one of the values of the
2560              style.
2561
2562              It is possible to group values for sets of commands which  allow
2563              a remote login, such as rlogin and ssh, by using the my-accounts
2564              tag.  Similarly, values for sets of commands which usually refer
2565              to the accounts of other people, such as talk and finger, can be
2566              grouped by using the other-accounts tag.  More  ambivalent  com‐
2567              mands may use the accounts tag.
2568
2569       users-hosts-ports
2570              Like  users-hosts but used for commands like telnet and contain‐
2571              ing strings of the form `user@host:port'.
2572
2573       verbose
2574              If set, as it is by default, the completion listing is more ver‐
2575              bose.  In particular many commands show descriptions for options
2576              if this style is `true'.
2577
2578       word   This is used by the _list completer, which prevents  the  inser‐
2579              tion  of  completions until a second completion attempt when the
2580              line has not changed.  The normal way of finding out if the line
2581              has  changed  is  to compare its entire contents between the two
2582              occasions.  If this style is `true', the comparison  is  instead
2583              performed only on the current word.  Hence if completion is per‐
2584              formed on another word with the same contents,  completion  will
2585              not be delayed.
2586

CONTROL FUNCTIONS

2588       The initialization script compinit redefines all the widgets which per‐
2589       form completion to call the supplied  widget  function  _main_complete.
2590       This function acts as a wrapper calling the so-called `completer' func‐
2591       tions that generate matches.  If _main_complete is  called  with  argu‐
2592       ments, these are taken as the names of completer functions to be called
2593       in the order given.  If no arguments are given, the set of functions to
2594       try is taken from the completer style.  For example, to use normal com‐
2595       pletion and correction if that doesn't generate any matches:
2596
2597              zstyle ':completion:*' completer _complete _correct
2598
2599       after calling compinit. The default value for this style is  `_complete
2600       _ignored',  i.e. normally only ordinary completion is tried, first with
2601       the effect of the ignored-patterns style  and  then  without  it.   The
2602       _main_complete  function  uses the return status of the completer func‐
2603       tions to decide if other completers should be called.   If  the  return
2604       status  is  zero,  no other completers are tried and the _main_complete
2605       function returns.
2606
2607       If the first argument to _main_complete is a single hyphen,  the  argu‐
2608       ments  will  not  be taken as names of completers.  Instead, the second
2609       argument gives a name to use in the completer field of the context  and
2610       the other arguments give a command name and arguments to call to gener‐
2611       ate the matches.
2612
2613       The following completer functions are contained  in  the  distribution,
2614       although  users may write their own.  Note that in contexts the leading
2615       underscore is stripped, for example basic completion  is  performed  in
2616       the context `:completion::complete:...'.
2617
2618       _all_matches
2619              This  completer  can  be  used to add a string consisting of all
2620              other matches.  As it influences later completers it must appear
2621              as  the first completer in the list.  The list of all matches is
2622              affected by the avoid-completer and old-matches styles described
2623              above.
2624
2625              It may be useful to use the _generic function described below to
2626              bind _all_matches to its own keystroke, for example:
2627
2628                     zle -C all-matches complete-word _generic
2629                     bindkey '^Xa' all-matches
2630                     zstyle ':completion:all-matches:*' old-matches only
2631                     zstyle ':completion:all-matches::::' completer _all_matches
2632
2633              Note that this does not generate completions by  itself:   first
2634              use  any  of  the  standard ways of generating a list of comple‐
2635              tions, then use ^Xa to show all matches.  It is possible instead
2636              to  add  a  standard  completer to the list and request that the
2637              list of all matches should be directly inserted:
2638
2639                     zstyle ':completion:all-matches::::' completer \
2640                            _all_matches _complete
2641                     zstyle ':completion:all-matches:*' insert true
2642
2643              In this case the old-matches style should not be set.
2644
2645       _approximate
2646              This is similar to the basic _complete completer but allows  the
2647              completions  to  undergo  corrections.   The  maximum  number of
2648              errors can  be  specified  by  the  max-errors  style;  see  the
2649              description of approximate matching in zshexpn(1) for how errors
2650              are counted.  Normally this completer will only be  tried  after
2651              the normal _complete completer:
2652
2653                     zstyle ':completion:*' completer _complete _approximate
2654
2655              This  will give correcting completion if and only if normal com‐
2656              pletion yields no possible completions.  When corrected  comple‐
2657              tions  are found, the completer will normally start menu comple‐
2658              tion allowing you to cycle through these strings.
2659
2660              This completer uses the tags corrections and original when  gen‐
2661              erating  the  possible corrections and the original string.  The
2662              format style for the former may contain the additional sequences
2663              `%e'  and  `%o'  which  will be replaced by the number of errors
2664              accepted to generate the corrections and  the  original  string,
2665              respectively.
2666
2667              The  completer  progressively  increases  the  number  of errors
2668              allowed up to the limit by the max-errors style, hence if a com‐
2669              pletion  is found with one error, no completions with two errors
2670              will be shown, and so on.  It modifies the completer name in the
2671              context  to  indicate  the  number of errors being tried: on the
2672              first try the completer field contains `approximate-1',  on  the
2673              second try `approximate-2', and so on.
2674
2675              When _approximate is called from another function, the number of
2676              errors to accept may be passed with the -a option.  The argument
2677              is  in  the  same  format  as  the  max-errors style, all in one
2678              string.
2679
2680              Note that this completer (and the _correct  completer  mentioned
2681              below)  can  be quite expensive to call, especially when a large
2682              number of errors are allowed.  One way to avoid this is  to  set
2683              up  the  completer  style  using the -e option to zstyle so that
2684              some completers are only used when  completion  is  attempted  a
2685              second time on the same string, e.g.:
2686
2687                     zstyle -e ':completion:*' completer '
2688                       if [[ $_last_try != "$HISTNO$BUFFER$CURSOR" ]]; then
2689                         _last_try="$HISTNO$BUFFER$CURSOR"
2690                         reply=(_complete _match _prefix)
2691                       else
2692                         reply=(_ignored _correct _approximate)
2693                       fi'
2694
2695              This uses the HISTNO parameter and the BUFFER and CURSOR special
2696              parameters that are available inside zle and completion  widgets
2697              to  find  out  if the command line hasn't changed since the last
2698              time completion was tried.  Only then are the _ignored, _correct
2699              and _approximate completers called.
2700
2701       _canonical_paths  [ -A var ] [ -N ] [ -MJV12nfX ] tag descr [ paths ...
2702       ]
2703              This completion function completes all paths given  to  it,  and
2704              also  tries to offer completions which point to the same file as
2705              one of the paths given (relative path when an absolute  path  is
2706              given,  and  vice versa; when ..'s are present in the word to be
2707              completed; and some paths got from symlinks).
2708
2709              -A, if specified, takes the paths from the array variable speci‐
2710              fied.  Paths  can also be specified on the command line as shown
2711              above.  -N, if  specified,  prevents  canonicalizing  the  paths
2712              given before using them for completion, in case they are already
2713              so. The options -M, -J, -V, -1, -2, -n, -F,  -X  are  passed  to
2714              compadd.
2715
2716              See _description for a description of tag and descr.
2717
2718       _cmdambivalent
2719              Completes the remaining positional arguments as an external com‐
2720              mand.  The external command and its arguments are  completed  as
2721              separate  arguments  (in  a  manner  appropriate  for completing
2722              /usr/bin/env) if there are  two  or  more  remaining  positional
2723              arguments  on  the  command line, and as a quoted command string
2724              (in the manner of system(...)) otherwise.  See  also  _cmdstring
2725              and _precommand.
2726
2727              This function takes no arguments.
2728
2729       _cmdstring
2730              Completes  an external command as a single argument, as for sys‐
2731              tem(...).
2732
2733       _complete
2734              This completer generates all  possible  completions  in  a  con‐
2735              text-sensitive  manner, i.e. using the settings defined with the
2736              compdef function explained above and the current settings of all
2737              special parameters.  This gives the normal completion behaviour.
2738
2739              To  complete  arguments  of commands, _complete uses the utility
2740              function _normal, which is in turn responsible for  finding  the
2741              particular function; it is described below.  Various contexts of
2742              the form -context- are handled specifically. These are all  men‐
2743              tioned above as possible arguments to the #compdef tag.
2744
2745              Before  trying  to find a function for a specific context, _com‐
2746              plete checks if the  parameter  `compcontext'  is  set.  Setting
2747              `compcontext'  allows  the  usual  completion  dispatching to be
2748              overridden which is useful in places such  as  a  function  that
2749              uses vared for input. If it is set to an array, the elements are
2750              taken to be the possible matches which will be  completed  using
2751              the tag `values' and the description `value'. If it is set to an
2752              associative array, the keys are used as the possible completions
2753              and  the  values (if non-empty) are used as descriptions for the
2754              matches.  If `compcontext' is set to a string containing colons,
2755              it  should  be of the form `tag:descr:action'.  In this case the
2756              tag and descr give the tag and description to use and the action
2757              indicates  what should be completed in one of the forms accepted
2758              by the _arguments utility function described below.
2759
2760              Finally, if `compcontext' is set to a string without colons, the
2761              value  is  taken as the name of the context to use and the func‐
2762              tion defined for that context will be called.  For this purpose,
2763              there  is  a special context named -command-line- that completes
2764              whole command lines (commands and their arguments).  This is not
2765              used  by the completion system itself but is nonetheless handled
2766              when explicitly called.
2767
2768       _correct
2769              Generate corrections, but not completions, for the current word;
2770              this is similar to _approximate but will not allow any number of
2771              extra characters at the cursor  as  that  completer  does.   The
2772              effect  is  similar to spell-checking.  It is based on _approxi‐
2773              mate, but the completer field in the context name is correct.
2774
2775              For example, with:
2776
2777                     zstyle ':completion:::::' completer \
2778                            _complete _correct _approximate
2779                     zstyle ':completion:*:correct:::' max-errors 2 not-numeric
2780                     zstyle ':completion:*:approximate:::' max-errors 3 numeric
2781
2782              correction will accept up to two errors.  If a numeric  argument
2783              is  given, correction will not be performed, but correcting com‐
2784              pletion will be, and will accept as many errors as given by  the
2785              numeric  argument.  Without a numeric argument, first correction
2786              and then correcting completion will be tried, with the first one
2787              accepting two errors and the second one accepting three errors.
2788
2789              When  _correct  is called as a function, the number of errors to
2790              accept may be given following the -a option.  The argument is in
2791              the same form a values to the accept style, all in one string.
2792
2793              This  completer  function  is  intended  to  be used without the
2794              _approximate completer or, as in the example,  just  before  it.
2795              Using  it  after  the  _approximate  completer  is useless since
2796              _approximate will at least generate the corrected strings gener‐
2797              ated by the _correct completer -- and probably more.
2798
2799       _expand
2800              This  completer function does not really perform completion, but
2801              instead checks if the word on the command line is  eligible  for
2802              expansion  and,  if  it is, gives detailed control over how this
2803              expansion is done.  For this to happen,  the  completion  system
2804              needs  to  be invoked with complete-word, not expand-or-complete
2805              (the default binding for TAB), as otherwise the string  will  be
2806              expanded by the shell's internal mechanism before the completion
2807              system is started.  Note also this completer  should  be  called
2808              before the _complete completer function.
2809
2810              The  tags used when generating expansions are all-expansions for
2811              the string containing all possible expansions,  expansions  when
2812              adding  the  possible  expansions as single matches and original
2813              when adding the original string from the  line.   The  order  in
2814              which  these strings are generated, if at all, can be controlled
2815              by the group-order and tag-order styles, as usual.
2816
2817              The format string for all-expansions and for expansions may con‐
2818              tain  the  sequence  `%o' which will be replaced by the original
2819              string from the line.
2820
2821              The kind of expansion to be tried is controlled by  the  substi‐
2822              tute, glob and subst-globs-only styles.
2823
2824              It is also possible to call _expand as a function, in which case
2825              the different modes may be selected with options: -s for substi‐
2826              tute, -g for glob and -o for subst-globs-only.
2827
2828       _expand_alias
2829              If  the word the cursor is on is an alias, it is expanded and no
2830              other completers are called.  The types of aliases which are  to
2831              be  expanded  can  be controlled with the styles regular, global
2832              and disabled.
2833
2834              This function is also a bindable command, see the section `Bind‐
2835              able Commands' below.
2836
2837       _extensions
2838              If  the  cursor follows the string `*.', filename extensions are
2839              completed. The extensions are taken from files in current direc‐
2840              tory  or  a  directory specified at the beginning of the current
2841              word. For exact matches, completion  continues  to  allow  other
2842              completers  such  as _expand to expand the pattern. The standard
2843              add-space and prefix-hidden styles are observed.
2844
2845       _external_pwds
2846              Completes current directories of other zsh  processes  belonging
2847              to the current user.
2848
2849              This  is intended to be used via _generic, bound to a custom key
2850              combination. Note that pattern matching is enabled  so  matching
2851              is performed similar to how it works with the _match completer.
2852
2853       _history
2854              Complete  words  from  the  shell's command  history.  This com‐
2855              pleter can be controlled by the remove-all-dups, and sort styles
2856              as for the _history_complete_word bindable command, see the sec‐
2857              tion `Bindable Commands' below and the section `Completion  Sys‐
2858              tem Configuration' above.
2859
2860       _ignored
2861              The  ignored-patterns  style  can  be  set to a list of patterns
2862              which are compared against possible completions;  matching  ones
2863              are  removed.   With  this  completer those matches can be rein‐
2864              stated, as if no ignored-patterns style were set.  The completer
2865              actually generates its own list of matches; which completers are
2866              invoked is determined in the same way as for  the  _prefix  com‐
2867              pleter.  The single-ignored style is also available as described
2868              above.
2869
2870       _list  This completer allows the insertion of  matches  to  be  delayed
2871              until  completion is attempted a second time without the word on
2872              the line being changed.  On the first attempt, only the list  of
2873              matches  will  be shown.  It is affected by the styles condition
2874              and word, see  the  section  `Completion  System  Configuration'
2875              above.
2876
2877       _match This  completer  is intended to be used after the _complete com‐
2878              pleter.  It behaves similarly but the string on the command line
2879              may be a pattern to match against trial completions.  This gives
2880              the effect of the GLOB_COMPLETE option.
2881
2882              Normally completion will be performed by taking the pattern from
2883              the  line,  inserting a `*' at the cursor position and comparing
2884              the resulting pattern with the possible  completions  generated.
2885              This  can  be  modified  with the match-original style described
2886              above.
2887
2888              The generated matches will  be  offered  in  a  menu  completion
2889              unless  the  insert-unambiguous  style is set to `true'; see the
2890              description above for other options for this style.
2891
2892              Note that matcher specifications defined globally or used by the
2893              completion  functions (the styles matcher-list and matcher) will
2894              not be used.
2895
2896       _menu  This completer was written as simple example  function  to  show
2897              how  menu  completion  can be enabled in shell code. However, it
2898              has the notable effect of disabling menu selection which can  be
2899              useful  with  _generic  based  widgets. It should be used as the
2900              first completer in the list.  Note that this is  independent  of
2901              the  setting  of the MENU_COMPLETE option and does not work with
2902              the other menu completion widgets such as reverse-menu-complete,
2903              or accept-and-menu-complete.
2904
2905       _oldlist
2906              This  completer  controls  how  the  standard completion widgets
2907              behave when there is an existing list of completions  which  may
2908              have  been  generated  by  a  special  completion  (i.e. a sepa‐
2909              rately-bound completion command).  It allows the  ordinary  com‐
2910              pletion  keys  to  continue  to use the list of completions thus
2911              generated, instead of producing a new list of  ordinary  contex‐
2912              tual  completions.   It  should appear in the list of completers
2913              before any of the widgets which generate matches.  It  uses  two
2914              styles:  old-list and old-menu, see the section `Completion Sys‐
2915              tem Configuration' above.
2916
2917       _precommand
2918              Complete an external command in word-separated arguments, as for
2919              exec and /usr/bin/env.
2920
2921       _prefix
2922              This  completer  can  be  used to try completion with the suffix
2923              (everything after the cursor) ignored.  In other words, the suf‐
2924              fix  will  not be considered to be part of the word to complete.
2925              The effect is similar to the expand-or-complete-prefix command.
2926
2927              The completer style is used to decide which other completers are
2928              to  be  called to generate matches.  If this style is unset, the
2929              list of completers set  for  the  current  context  is  used  --
2930              except,  of  course, the _prefix completer itself.  Furthermore,
2931              if this completer appears more than once in  the  list  of  com‐
2932              pleters  only  those  completers  not  already tried by the last
2933              invocation of _prefix will be called.
2934
2935              For example, consider this global completer style:
2936
2937                     zstyle ':completion:*' completer \
2938                         _complete _prefix _correct _prefix:foo
2939
2940              Here, the _prefix completer tries normal completion but ignoring
2941              the  suffix.   If that doesn't generate any matches, and neither
2942              does the call to the _correct completer after it,  _prefix  will
2943              be called a second time and, now only trying correction with the
2944              suffix ignored.  On the second invocation the completer part  of
2945              the context appears as `foo'.
2946
2947              To use _prefix as the last resort and try only normal completion
2948              when it is invoked:
2949
2950                     zstyle ':completion:*' completer _complete ... _prefix
2951                     zstyle ':completion::prefix:*' completer _complete
2952
2953              The add-space style is also respected.  If it is set  to  `true'
2954              then  _prefix  will insert a space between the matches generated
2955              (if any) and the suffix.
2956
2957              Note that this completer is only useful if the  COMPLETE_IN_WORD
2958              option is set; otherwise, the cursor will be moved to the end of
2959              the current word before the completion code is called and  hence
2960              there will be no suffix.
2961
2962       _user_expand
2963              This  completer  behaves  similarly to the _expand completer but
2964              instead  performs  expansions  defined  by  users.   The  styles
2965              add-space  and sort styles specific to the _expand completer are
2966              usable with _user_expand in addition  to  other  styles  handled
2967              more generally by the completion system.  The tag all-expansions
2968              is also available.
2969
2970              The expansion depends  on  the  array  style  user-expand  being
2971              defined  for  the current context; remember that the context for
2972              completers is less specific than that for contextual  completion
2973              as  the  full  context has not yet been determined.  Elements of
2974              the array may have one of the following forms:
2975
2976              $hash
2977
2978                     hash is the name of an associative array.  Note  this  is
2979                     not  a  full  parameter  expression, merely a $, suitably
2980                     quoted to prevent immediate expansion,  followed  by  the
2981                     name  of  an  associative  array.  If the trial expansion
2982                     word matches a key in hash, the  resulting  expansion  is
2983                     the corresponding value.
2984              _func
2985
2986                     _func  is  the  name  of a shell function whose name must
2987                     begin with _ but is not otherwise special to the  comple‐
2988                     tion  system.  The function is called with the trial word
2989                     as an argument.  If the word is to be expanded, the func‐
2990                     tion  should set the array reply to a list of expansions.
2991                     Optionally, it can set REPLY to a word that will be  used
2992                     as  a  description for the set of expansions.  The return
2993                     status of the function is irrelevant.

BINDABLE COMMANDS

2995       In addition to the context-dependent completions  provided,  which  are
2996       expected to work in an intuitively obvious way, there are a few widgets
2997       implementing special behaviour which can be bound separately  to  keys.
2998       The following is a list of these and their default bindings.
2999
3000       _bash_completions
3001              This  function  is  used by two widgets, _bash_complete-word and
3002              _bash_list-choices.  It exists  to  provide  compatibility  with
3003              completion  bindings in bash.  The last character of the binding
3004              determines what is completed: `!', command names; `$',  environ‐
3005              ment  variables;  `@',  host  names;  `/',  file names; `~' user
3006              names.  In bash, the binding preceded by `\e' gives  completion,
3007              and  preceded  by `^X' lists options.  As some of these bindings
3008              clash with standard zsh bindings, only `\e~' and `^X~' are bound
3009              by  default.   To add the rest, the following should be added to
3010              .zshrc after compinit has been run:
3011
3012                     for key in '!' '$' '@' '/' '~'; do
3013                       bindkey "\e$key" _bash_complete-word
3014                       bindkey "^X$key" _bash_list-choices
3015                     done
3016
3017              This includes the bindings for `~' in  case  they  were  already
3018              bound  to  something else; the completion code does not override
3019              user bindings.
3020
3021       _correct_filename (^XC)
3022              Correct the filename path at the cursor position.  Allows up  to
3023              six  errors in the name.  Can also be called with an argument to
3024              correct a filename path, independently of zle; the correction is
3025              printed on standard output.
3026
3027       _correct_word (^Xc)
3028              Performs correction of the current argument using the usual con‐
3029              textual completions as possible choices. This stores the  string
3030              `correct-word'  in  the  function  field of the context name and
3031              then calls the _correct completer.
3032
3033       _expand_alias (^Xa)
3034              This function can be used as a completer and as a bindable  com‐
3035              mand.   It  expands the word the cursor is on if it is an alias.
3036              The types of alias expanded can be controlled  with  the  styles
3037              regular, global and disabled.
3038
3039              When  used as a bindable command there is one additional feature
3040              that can be selected by setting the complete  style  to  `true'.
3041              In  this  case,  if  the  word  is  not  the  name  of an alias,
3042              _expand_alias tries to complete the word to a  full  alias  name
3043              without  expanding  it.  It leaves the cursor directly after the
3044              completed word so that invoking  _expand_alias  once  more  will
3045              expand the now-complete alias name.
3046
3047       _expand_word (^Xe)
3048              Performs expansion on the current word:  equivalent to the stan‐
3049              dard expand-word  command,  but  using  the  _expand  completer.
3050              Before  calling  it, the function field of the context is set to
3051              `expand-word'.
3052
3053       _generic
3054              This function is not defined  as  a  widget  and  not  bound  by
3055              default.   However,  it  can be used to define a widget and will
3056              then store the name of the widget in the function field  of  the
3057              context and call the completion system.  This allows custom com‐
3058              pletion widgets with their own  set  of  style  settings  to  be
3059              defined  easily.   For example, to define a widget that performs
3060              normal completion and starts menu selection:
3061
3062                     zle -C foo complete-word _generic
3063                     bindkey '...' foo
3064                     zstyle ':completion:foo:*' menu yes select=1
3065
3066              Note in particular that the completer style may be set  for  the
3067              context in order to change the set of functions used to generate
3068              possible matches.  If _generic is called with  arguments,  those
3069              are  passed  through to _main_complete as the list of completers
3070              in place of those defined by the completer style.
3071
3072       _history_complete_word (\e/)
3073              Complete words from the shell's command history. This  uses  the
3074              list, remove-all-dups, sort, and stop styles.
3075
3076       _most_recent_file (^Xm)
3077              Complete  the  name  of the most recently modified file matching
3078              the pattern on the command line (which may be blank).  If  given
3079              a  numeric  argument  N, complete the Nth most recently modified
3080              file.  Note the completion, if any, is always unique.
3081
3082       _next_tags (^Xn)
3083              This command alters the set of matches used to that for the next
3084              tag,  or  set of tags, either as given by the tag-order style or
3085              as set by default; these matches would otherwise not  be  avail‐
3086              able.   Successive  invocations of the command cycle through all
3087              possible sets of tags.
3088
3089       _read_comp (^X^R)
3090              Prompt the user for a string, and use that to perform completion
3091              on  the  current  word.   There  are  two  possibilities for the
3092              string.  First, it can be a set  of  words  beginning  `_',  for
3093              example  `_files  -/', in which case the function with any argu‐
3094              ments will be called to generate the  completions.   Unambiguous
3095              parts of the function name will be completed automatically (nor‐
3096              mal completion is not available at this point) until a space  is
3097              typed.
3098
3099              Second, any other string will be passed as a set of arguments to
3100              compadd and should hence be an expression specifying what should
3101              be completed.
3102
3103              A  very  restricted  set  of  editing commands is available when
3104              reading the string:  `DEL' and `^H' delete the  last  character;
3105              `^U'  deletes  the  line,  and `^C' and `^G' abort the function,
3106              while `RET' accepts the completion.  Note  the  string  is  used
3107              verbatim  as  a  command  line,  so  arguments must be quoted in
3108              accordance with standard shell rules.
3109
3110              Once a string has been read, the next call  to  _read_comp  will
3111              use  the existing string instead of reading a new one.  To force
3112              a new string to be read, call _read_comp with  a  numeric  argu‐
3113              ment.
3114
3115       _complete_debug (^X?)
3116              This widget performs ordinary completion, but captures in a tem‐
3117              porary file a trace of the shell commands executed by  the  com‐
3118              pletion  system.   Each completion attempt gets its own file.  A
3119              command to view each of these files is pushed  onto  the  editor
3120              buffer stack.
3121
3122       _complete_help (^Xh)
3123              This  widget  displays  information about the context names, the
3124              tags, and the completion functions used when completing  at  the
3125              current  cursor position. If given a numeric argument other than
3126              1 (as in `ESC-2 ^Xh'), then the styles used and the contexts for
3127              which they are used will be shown, too.
3128
3129              Note  that  the  information  about styles may be incomplete; it
3130              depends on the information available from the  completion  func‐
3131              tions  called,  which  in  turn  is determined by the user's own
3132              styles and other settings.
3133
3134       _complete_help_generic
3135              Unlike other commands listed here, this must  be  created  as  a
3136              normal ZLE widget rather than a completion widget (i.e. with zle
3137              -N).  It is used for generating help with a widget bound to  the
3138              _generic widget that is described above.
3139
3140              If  this widget is created using the name of the function, as it
3141              is by default, then when executed it will read a  key  sequence.
3142              This  is expected to be bound to a call to a completion function
3143              that uses the _generic widget.  That widget  will  be  executed,
3144              and  information  provided  in  the  same  format that the _com‐
3145              plete_help widget displays for contextual completion.
3146
3147              If the widget's name contains debug, for example if it  is  cre‐
3148              ated as `zle -N _complete_debug_generic _complete_help_generic',
3149              it will read and execute the keystring for a generic  widget  as
3150              before, but then generate debugging information as done by _com‐
3151              plete_debug for contextual completion.
3152
3153              If the widget's  name  contains  noread,  it  will  not  read  a
3154              keystring  but  instead  arrange  that the next use of a generic
3155              widget run in the same shell will have the effect  as  described
3156              above.
3157
3158              The    widget    works    by   setting   the   shell   parameter
3159              ZSH_TRACE_GENERIC_WIDGET which is read by  _generic.   Unsetting
3160              the parameter cancels any pending effect of the noread form.
3161
3162              For example, after executing the following:
3163
3164                     zle -N _complete_debug_generic _complete_help_generic
3165                     bindkey '^x:' _complete_debug_generic
3166
3167              typing `C-x :' followed by the key sequence for a generic widget
3168              will cause trace output for that widget to be saved to a file.
3169
3170       _complete_tag (^Xt)
3171              This widget completes symbol tags created by the etags or  ctags
3172              programmes (note there is no connection with the completion sys‐
3173              tem's tags) stored in a file TAGS, in the format used by  etags,
3174              or  tags,  in the format created by ctags.  It will look back up
3175              the path hierarchy for the first occurrence of either  file;  if
3176              both  exist,  the  file  TAGS is preferred.  You can specify the
3177              full path to a TAGS or tags file by setting the parameter $TAGS‐
3178              FILE  or  $tagsfile  respectively.  The corresponding completion
3179              tags used are etags and vtags, after emacs and vi respectively.
3180

UTILITY FUNCTIONS

3182       Descriptions follow for utility functions that may be useful when writ‐
3183       ing  completion  functions.   If functions are installed in subdirecto‐
3184       ries, most of these reside in the Base subdirectory.  Like the  example
3185       functions  for commands in the distribution, the utility functions gen‐
3186       erating matches all follow the convention of returning status  zero  if
3187       they  generated  completions  and  non-zero  if no matching completions
3188       could be added.
3189
3190       _absolute_command_paths
3191              This function completes  external  commands  as  absolute  paths
3192              (unlike  _command_names -e which completes their basenames).  It
3193              takes no arguments.
3194
3195       _all_labels [ -x ] [ -12VJ ] tag name descr [ command arg ... ]
3196              This is a  convenient  interface  to  the  _next_label  function
3197              below,  implementing  the loop shown in the _next_label example.
3198              The command  and  its  arguments  are  called  to  generate  the
3199              matches.  The options stored in the parameter name will automat‐
3200              ically be inserted into the args passed to  the  command.   Nor‐
3201              mally,  they  are  put directly after the command, but if one of
3202              the args is a single hyphen, they are inserted  directly  before
3203              that.   If  the  hyphen is the last argument, it will be removed
3204              from the argument list  before  the  command  is  called.   This
3205              allows  _all_labels  to  be  used  in almost all cases where the
3206              matches can be generated by a single call to the compadd builtin
3207              command or by a call to one of the utility functions.
3208
3209              For example:
3210
3211                     local expl
3212                     ...
3213                     if _requested foo; then
3214                       ...
3215                       _all_labels foo expl '...' compadd ... - $matches
3216                     fi
3217
3218              Will complete the strings from the matches parameter, using com‐
3219              padd with additional options which  will  take  precedence  over
3220              those generated by _all_labels.
3221
3222       _alternative [ -O name ] [ -C name ] spec ...
3223              This  function is useful in simple cases where multiple tags are
3224              available.  Essentially  it  implements  a  loop  like  the  one
3225              described for the _tags function below.
3226
3227              The  tags to use and the action to perform if a tag is requested
3228              are  described  using  the  specs  which  are   of   the   form:
3229              `tag:descr:action'.  The tags are offered using _tags and if the
3230              tag is requested, the action is executed with the given descrip‐
3231              tion  descr.   The  actions are those accepted by the _arguments
3232              function (described below), excluding the `->state'  and  `=...'
3233              forms.
3234
3235              For example, the action may be a simple function call:
3236
3237                     _alternative \
3238                         'users:user:_users' \
3239                         'hosts:host:_hosts'
3240
3241              offers usernames and hostnames as possible matches, generated by
3242              the _users and _hosts functions respectively.
3243
3244              Like _arguments, this function uses _all_labels to  execute  the
3245              actions,  which  will  loop over all sets of tags.  Special han‐
3246              dling is only required if there is an additional valid tag,  for
3247              example inside a function called from _alternative.
3248
3249              The  option  `-O  name' is used in the same way as by the _argu‐
3250              ments function.  In other words, the elements of the name  array
3251              will be passed to compadd when executing an action.
3252
3253              Like  _tags  this function supports the -C option to give a dif‐
3254              ferent name for the argument context field.
3255
3256
3257       _arguments [ -nswWCRS ] [ -A pat ] [ -O name ] [ -M matchspec ]
3258                  [ : ] spec ...
3259       _arguments [ opt ... ] -- [ -l ] [ -i pats ] [ -s pair ]
3260                  [ helpspec ...]
3261              This function can be used to give a complete  specification  for
3262              completion  for  a  command whose arguments follow standard UNIX
3263              option and argument conventions.
3264
3265              Options Overview
3266
3267              Options to _arguments itself must be in separate words, i.e.  -s
3268              -w,  not  -sw.   The options are followed by specs that describe
3269              options and arguments of the analyzed command.  To avoid ambigu‐
3270              ity,  all options to _arguments itself may be separated from the
3271              spec forms by a single colon.
3272
3273              The `--' form is used to intuit spec forms from the help  output
3274              of the command being analyzed, and is described in detail below.
3275              The opts for the `--' form are otherwise the same options as the
3276              first  form.  Note that `-s' following `--' has a distinct mean‐
3277              ing from `-s' preceding `--', and both may appear.
3278
3279              The option switches -s, -S, -A, -w, and -W affect how _arguments
3280              parses  the analyzed command line's options.  These switches are
3281              useful for commands with standard argument parsing.
3282
3283              The options of _arguments have the following meanings:
3284
3285              -n     With this option, _arguments sets the  parameter  NORMARG
3286                     to  the  position  of  the  first  normal argument in the
3287                     $words array, i.e. the position  after  the  end  of  the
3288                     options.   If that argument has not been reached, NORMARG
3289                     is set to -1.  The caller should  declare  `integer  NOR‐
3290                     MARG' if the -n option is passed; otherwise the parameter
3291                     is not used.
3292
3293              -s     Enable option stacking for single-letter options, whereby
3294                     multiple  single-letter  options  may  be combined into a
3295                     single word.  For example, the two options `-x' and  `-y'
3296                     may  be  combined  into a single word `-xy'.  By default,
3297                     every word corresponds to a single option name (`-xy'  is
3298                     a single option named `xy').
3299
3300                     Options  beginning  with a single hyphen or plus sign are
3301                     eligible for stacking; words beginning with  two  hyphens
3302                     are not.
3303
3304                     Note  that  -s after -- has a different meaning, which is
3305                     documented in the segment entitled `Deriving  spec  forms
3306                     from the help output'.
3307
3308              -w     In combination with -s, allow option stacking even if one
3309                     or more of the options take arguments.  For  example,  if
3310                     -x  takes an argument, with no -s, `-xy' is considered as
3311                     a single (unhandled) option; with -s, -xy  is  an  option
3312                     with  the  argument  `y'; with both -s and -w, -xy is the
3313                     option -x and the option -y with arguments to -x (and  to
3314                     -y,  if  it  takes arguments) still to come in subsequent
3315                     words.
3316
3317              -W     This option takes -w a stage further:  it is possible  to
3318                     complete  single-letter  options  even  after an argument
3319                     that occurs in the same word.  However, it depends on the
3320                     action performed whether options will really be completed
3321                     at this point.  For more control, use a utility  function
3322                     like _guard as part of the action.
3323
3324              -C     Modify the curcontext parameter for an action of the form
3325                     `->state'.  This is discussed in detail below.
3326
3327              -R     Return status 300 instead of zero when a $state is to  be
3328                     handled, in the `->string' syntax.
3329
3330              -S     Do  not  complete  options  after a `--' appearing on the
3331                     line, and ignore the `--'.  For example, with -S, in  the
3332                     line
3333
3334                            foobar -x -- -y
3335
3336                     the  `-x' is considered an option, the `-y' is considered
3337                     an argument, and the `--' is considered to be neither.
3338
3339              -A pat Do not complete options after the first non-option  argu‐
3340                     ment  on the line.  pat is a pattern matching all strings
3341                     which are not to be taken as arguments.  For example,  to
3342                     make  _arguments  stop completing options after the first
3343                     normal argument, but ignoring all strings starting with a
3344                     hyphen  even if they are not described by one of the opt‐
3345                     specs, the form is `-A "-*"'.
3346
3347              -O name
3348                     Pass the elements of the array name as arguments to func‐
3349                     tions  called  to  execute actions.  This is discussed in
3350                     detail below.
3351
3352              -M matchspec
3353                     Use the  match  specification  matchspec  for  completing
3354                     option  names  and  values.  The default matchspec allows
3355                     partial word completion after `_' and `-', such  as  com‐
3356                     pleting `-f-b' to `-foo-bar'.  The default matchspec is:
3357                     r:|[_-]=* r:|=*
3358
3359              specs: overview
3360
3361              Each of the following forms is a spec describing individual sets
3362              of options or arguments on the command line being analyzed.
3363
3364              n:message:action
3365              n::message:action
3366                     This describes the n'th  normal  argument.   The  message
3367                     will  be  printed  above  the  matches  generated and the
3368                     action indicates what can be completed in  this  position
3369                     (see  below).  If there are two colons before the message
3370                     the argument is optional.  If the message  contains  only
3371                     white  space,  nothing  will be printed above the matches
3372                     unless the action adds an explanation string itself.
3373
3374              :message:action
3375              ::message:action
3376                     Similar, but describes the next argument, whatever number
3377                     that  happens  to  be.  If all arguments are specified in
3378                     this form in the correct order the numbers  are  unneces‐
3379                     sary.
3380
3381              *:message:action
3382              *::message:action
3383              *:::message:action
3384                     This  describes  how  arguments (usually non-option argu‐
3385                     ments, those not beginning with - or +) are  to  be  com‐
3386                     pleted  when neither of the first two forms was provided.
3387                     Any number of arguments can be completed in this fashion.
3388
3389                     With two colons before the  message,  the  words  special
3390                     array  and  the CURRENT special parameter are modified to
3391                     refer only to the normal arguments  when  the  action  is
3392                     executed or evaluated.  With three colons before the mes‐
3393                     sage they are modified to refer only to the normal  argu‐
3394                     ments covered by this description.
3395
3396              optspec
3397              optspec:...
3398                     This  describes  an option.  The colon indicates handling
3399                     for one or more arguments to the option;  if  it  is  not
3400                     present, the option is assumed to take no arguments.
3401
3402                     The  following  forms  are available for the initial opt‐
3403                     spec, whether or not the option has arguments.
3404
3405                     *optspec
3406                            Here optspec is one of the remaining forms  below.
3407                            This   indicates  the  following  optspec  may  be
3408                            repeated.  Otherwise if the  corresponding  option
3409                            is already present on the command line to the left
3410                            of the cursor it will not be offered again.
3411
3412                     -optname
3413                     +optname
3414                            In the simplest  form  the  optspec  is  just  the
3415                            option name beginning with a minus or a plus sign,
3416                            such as `-foo'.  The first argument for the option
3417                            (if  any)  must follow as a separate word directly
3418                            after the option.
3419
3420                            Either of `-+optname' and `+-optname' can be  used
3421                            to  specify  that  -optname  and +optname are both
3422                            valid.
3423
3424                            In all the remaining forms, the leading `-' may be
3425                            replaced by or paired with `+' in this way.
3426
3427                     -optname-
3428                            The   first  argument  of  the  option  must  come
3429                            directly after the option name in the  same  word.
3430                            For  example,  `-foo-:...' specifies that the com‐
3431                            pleted  option  and  argument   will   look   like
3432                            `-fooarg'.
3433
3434                     -optname+
3435                            The  first  argument  may appear immediately after
3436                            optname in the same word, or may appear as a sepa‐
3437                            rate   word   after   the  option.   For  example,
3438                            `-foo+:...' specifies that  the  completed  option
3439                            and  argument  will  look like either `-fooarg' or
3440                            `-foo arg'.
3441
3442                     -optname=
3443                            The argument may appear as the next  word,  or  in
3444                            same  word  as the option name provided that it is
3445                            separated from it by an equals sign,  for  example
3446                            `-foo=arg' or `-foo arg'.
3447
3448                     -optname=-
3449                            The  argument  to  the option must appear after an
3450                            equals sign in the same word, and may not be given
3451                            in the next argument.
3452
3453                     optspec[explanation]
3454                            An  explanation  string  may be appended to any of
3455                            the preceding forms of optspec by enclosing it  in
3456                            brackets, as in `-q[query operation]'.
3457
3458                            The  verbose  style  is used to decide whether the
3459                            explanation strings are displayed with the  option
3460                            in a completion listing.
3461
3462                            If  no  bracketed  explanation string is given but
3463                            the auto-description style is  set  and  only  one
3464                            argument  is described for this optspec, the value
3465                            of the style is displayed, with any appearance  of
3466                            the sequence `%d' in it replaced by the message of
3467                            the first optarg that  follows  the  optspec;  see
3468                            below.
3469
3470                     It  is  possible for options with a literal `+' or `=' to
3471                     appear, but that character must be  quoted,  for  example
3472                     `-\+'.
3473
3474                     Each  optarg  following  an  optspec must take one of the
3475                     following forms:
3476
3477                     :message:action
3478                     ::message:action
3479                            An argument to the option; message and action  are
3480                            treated  as  for ordinary arguments.  In the first
3481                            form, the argument is mandatory, and in the second
3482                            form it is optional.
3483
3484                            This  group may be repeated for options which take
3485                            multiple  arguments.   In   other   words,   :mes‐
3486                            sage1:action1:message2:action2  specifies that the
3487                            option takes two arguments.
3488
3489                     :*pattern:message:action
3490                     :*pattern::message:action
3491                     :*pattern:::message:action
3492                            This describes multiple arguments.  Only the  last
3493                            optarg for an option taking multiple arguments may
3494                            be given in this form.  If the  pattern  is  empty
3495                            (i.e.  :*:),  all  the remaining words on the line
3496                            are to be completed as described  by  the  action;
3497                            otherwise,  all  the  words  up to and including a
3498                            word matching the  pattern  are  to  be  completed
3499                            using the action.
3500
3501                            Multiple  colons  are  treated  as for the `*:...'
3502                            forms for ordinary arguments:  when the message is
3503                            preceded  by  two  colons, the words special array
3504                            and the CURRENT  special  parameter  are  modified
3505                            during  the  execution or evaluation of the action
3506                            to refer only to the words after the option.  When
3507                            preceded  by  three  colons,  they are modified to
3508                            refer only to the words covered by  this  descrip‐
3509                            tion.
3510
3511              Any literal colon in an optname, message, or action must be pre‐
3512              ceded by a backslash, `\:'.
3513
3514              Each of the forms above may be preceded by a list in parentheses
3515              of option names and argument numbers.  If the given option is on
3516              the command line, the options and arguments indicated in  paren‐
3517              theses   will  not  be  offered.   For  example,  `(-two  -three
3518              1)-one:...' completes the option `-one'; if this appears on  the
3519              command line, the options -two and -three and the first ordinary
3520              argument will not be completed after it.  `(-foo):...' specifies
3521              an  ordinary  argument completion; -foo will not be completed if
3522              that argument is already present.
3523
3524              Other items may appear in the list of excluded options to  indi‐
3525              cate  various  other  items  that should not be applied when the
3526              current specification is matched: a single star (*) for the rest
3527              arguments  (i.e.  a  specification of the form `*:...'); a colon
3528              (:) for all normal (non-option-) arguments; and a hyphen (-) for
3529              all options.  For example, if `(*)' appears before an option and
3530              the option appears on the command line, the  list  of  remaining
3531              arguments  (those  shown in the above table beginning with `*:')
3532              will not be completed.
3533
3534              To aid in reuse of specifications, it is possible to precede any
3535              of  the  forms  above  with `!'; then the form will no longer be
3536              completed, although if the option or  argument  appears  on  the
3537              command  line  they will be skipped as normal.  The main use for
3538              this is when the arguments are given by an array, and _arguments
3539              is  called  repeatedly  for more specific contexts: on the first
3540              call `_arguments $global_options' is  used,  and  on  subsequent
3541              calls `_arguments !$^global_options'.
3542
3543              specs: actions
3544
3545              In each of the forms above the action determines how completions
3546              should be generated.  Except for the `->string' form below,  the
3547              action  will  be executed by calling the _all_labels function to
3548              process all tag labels.  No special handling of tags  is  needed
3549              unless a function call introduces a new one.
3550
3551              The  functions called to execute actions will be called with the
3552              elements of the array named by the `-O  name'  option  as  argu‐
3553              ments.   This  can be used, for example, to pass the same set of
3554              options for the compadd builtin to all actions.
3555
3556              The forms for action are as follows.
3557
3558               (single unquoted space)
3559                     This is useful where an argument is required  but  it  is
3560                     not  possible  or  desirable  to generate matches for it.
3561                     The message will be displayed but no completions  listed.
3562                     Note  that  even in this case the colon at the end of the
3563                     message is needed; it may only be omitted when neither  a
3564                     message nor an action is given.
3565
3566              (item1 item2 ...)
3567                     One of a list of possible matches, for example:
3568
3569                            :foo:(foo bar baz)
3570
3571              ((item1\:desc1 ...))
3572                     Similar to the above, but with descriptions for each pos‐
3573                     sible match.  Note the backslash before the  colon.   For
3574                     example,
3575
3576                            :foo:((a\:bar b\:baz))
3577
3578                     The  matches  will be listed together with their descrip‐
3579                     tions if the description style is set with the values tag
3580                     in the context.
3581
3582              ->string
3583                     In  this  form,  _arguments  processes  the arguments and
3584                     options and then returns control to the calling  function
3585                     with  parameters set to indicate the state of processing;
3586                     the calling function then makes its own arrangements  for
3587                     generating  completions.   For  example,  functions  that
3588                     implement a state machine can use this type of action.
3589
3590                     Where _arguments encounters action in the `->string' for‐
3591                     mat,  it  will  strip all leading and trailing whitespace
3592                     from string and set the array state to  the  set  of  all
3593                     strings for which an action is to be performed.  The ele‐
3594                     ments of the array state_descr are  assigned  the  corre‐
3595                     sponding  message  field from each optarg containing such
3596                     an action.
3597
3598                     By default and in common with all other well behaved com‐
3599                     pletion  functions,  _arguments returns status zero if it
3600                     was able to add matches and non-zero otherwise.  However,
3601                     if the -R option is given, _arguments will instead return
3602                     a status of 300 to indicate that $state is to be handled.
3603
3604                     In addition to $state and $state_descr,  _arguments  also
3605                     sets   the   global   parameters  `context',  `line'  and
3606                     `opt_args' as described below, and  does  not  reset  any
3607                     changes made to the special parameters such as PREFIX and
3608                     words.  This gives the calling  function  the  choice  of
3609                     resetting  these  parameters  or  propagating  changes in
3610                     them.
3611
3612                     A function calling _arguments with at  least  one  action
3613                     containing  a `->string' must therefore declare appropri‐
3614                     ate local parameters:
3615
3616                            local context state state_descr line
3617                            typeset -A opt_args
3618
3619                     to prevent _arguments from altering the  global  environ‐
3620                     ment.
3621
3622              {eval-string}
3623                     A string in braces is evaluated as shell code to generate
3624                     matches.  If the eval-string itself does not  begin  with
3625                     an opening parenthesis or brace it is split into separate
3626                     words before execution.
3627
3628              = action
3629                     If the action starts with `= ' (an equals  sign  followed
3630                     by  a  space), _arguments will insert the contents of the
3631                     argument field of the current context as  the  new  first
3632                     element  in  the  words  special  array and increment the
3633                     value of the CURRENT special  parameter.   This  has  the
3634                     effect of inserting a dummy word onto the completion com‐
3635                     mand line while not changing the point at  which  comple‐
3636                     tion is taking place.
3637
3638                     This  is  most  useful  with  one  of the specifiers that
3639                     restrict the words on  the  command  line  on  which  the
3640                     action  is  to  operate  (the  two- and three-colon forms
3641                     above).  One particular use  is  when  an  action  itself
3642                     causes  _arguments on a restricted range; it is necessary
3643                     to use this trick to insert an appropriate  command  name
3644                     into  the  range  for the second call to _arguments to be
3645                     able to parse the line.
3646
3647               word...
3648              word...
3649                     This covers all forms other than  those  above.   If  the
3650                     action  starts  with a space, the remaining list of words
3651                     will be invoked unchanged.
3652
3653                     Otherwise it will be  invoked  with  some  extra  strings
3654                     placed  after the first word; these are to be passed down
3655                     as options to the compadd builtin.  They ensure that  the
3656                     state specified by _arguments, in particular the descrip‐
3657                     tions of options and arguments, is  correctly  passed  to
3658                     the  completion  command.  These additional arguments are
3659                     taken from the array parameter `expl'; this will  be  set
3660                     up  before executing the action and hence may be referred
3661                     to inside it, typically  in  an  expansion  of  the  form
3662                     `$expl[@]' which preserves empty elements of the array.
3663
3664              During  the  performance  of the action the array `line' will be
3665              set to the normal arguments from  the  command  line,  i.e.  the
3666              words from the command line after the command name excluding all
3667              options and their arguments.  Options are stored in the associa‐
3668              tive  array `opt_args' with option names as keys and their argu‐
3669              ments as the values.  For options that have more than one  argu‐
3670              ment  these  are  given as one string, separated by colons.  All
3671              colons and backslashes in the original  arguments  are  preceded
3672              with backslashes.
3673
3674              The  parameter  `context'  is  set when returning to the calling
3675              function to perform an action of the form `->string'.  It is set
3676              to an array of elements corresponding to the elements of $state.
3677              Each element is a suitable name for the argument  field  of  the
3678              context: either a string of the form `option-opt-n' for the n'th
3679              argument of the option -opt, or a  string  of  the  form  `argu‐
3680              ment-n'  for  the  n'th argument.  For `rest' arguments, that is
3681              those in the list at the end not handled by position, n  is  the
3682              string `rest'.  For example, when completing the argument of the
3683              -o option, the name is `option-o-1', while for the second normal
3684              (non-option-) argument it is `argument-2'.
3685
3686              Furthermore,  during  the  evaluation  of the action the context
3687              name in the curcontext parameter is altered to append  the  same
3688              string that is stored in the context parameter.
3689
3690              The  option -C tells _arguments to modify the curcontext parame‐
3691              ter for an action of the form `->state'.  This is  the  standard
3692              parameter  used  to  keep track of the current context.  Here it
3693              (and not the context array) should be made local to the  calling
3694              function  to avoid passing back the modified value and should be
3695              initialised to the current value at the start of the function:
3696
3697                     local curcontext="$curcontext"
3698
3699              This is useful where it is not possible for multiple  states  to
3700              be valid together.
3701
3702              Grouping Options
3703
3704              Options  can  be grouped to simplify exclusion lists. A group is
3705              introduced with `+' followed by a name for the group in the sub‐
3706              sequent  word.  Whole groups can then be referenced in an exclu‐
3707              sion list or a group name can be used  to  disambiguate  between
3708              two forms of the same option. For example:
3709
3710                     _arguments \
3711                         '(group2--x)-a' \
3712                       + group1 \
3713                         -m \
3714                         '(group2)-n' \
3715                       + group2 \
3716                         -x -y
3717
3718              If  the  name  of a group is specified in the form `(name)' then
3719              only one value from that group will ever be completed; more for‐
3720              mally,  all  specifications  are mutually exclusive to all other
3721              specifications in  that  group.  This  is  useful  for  defining
3722              options that are aliases for each other. For example:
3723
3724                     _arguments \
3725                         -a -b \
3726                       + '(operation)' \
3727                         {-c,--compress}'[compress]' \
3728                         {-d,--decompress}'[decompress]' \
3729                         {-l,--list}'[list]'
3730
3731              If  an  option  in  a  group  appears on the command line, it is
3732              stored in the associative array `opt_args'  with  'group-option'
3733              as a key.  In the example above, a key `operation--c' is used if
3734              the option `-c' is present on the command line.
3735
3736              Specifying Multiple Sets of Arguments
3737
3738              It is possible to specify multiple sets of options and arguments
3739              with  the  sets  separated  by single hyphens. This differs from
3740              groups in that sets are considered to be mutually  exclusive  of
3741              each other.
3742
3743              Specifications  before the first set and from any group are com‐
3744              mon to all sets. For example:
3745
3746                     _arguments \
3747                         -a \
3748                       - set1 \
3749                         -c \
3750                       - set2 \
3751                         -d \
3752                         ':arg:(x2 y2)'
3753
3754              This defines two sets.   When  the  command  line  contains  the
3755              option  `-c',  the `-d' option and the argument will not be con‐
3756              sidered possible completions.  When it contains `-d' or an argu‐
3757              ment,  the  option  `-c' will not be considered.  However, after
3758              `-a' both sets will still be considered valid.
3759
3760              As for groups, the name of a set may appear in exclusion  lists,
3761              either alone or preceding a normal option or argument specifica‐
3762              tion.
3763
3764              The completion code has to parse the command line separately for
3765              each set. This can be slow so sets should only be used when nec‐
3766              essary.  A useful alternative is often an  option  specification
3767              with  rest-arguments  (as in `-foo:*:...'); here the option -foo
3768              swallows up all remaining arguments as described by  the  optarg
3769              definitions.
3770
3771              Deriving spec forms from the help output
3772
3773              The  option `--' allows _arguments to work out the names of long
3774              options that support the `--help' option which  is  standard  in
3775              many GNU commands.  The command word is called with the argument
3776              `--help' and the output examined for option names.  Clearly,  it
3777              can  be dangerous to pass this to commands which may not support
3778              this option as the behaviour of the command is unspecified.
3779
3780              In addition to options, `_arguments --' will try to  deduce  the
3781              types   of   arguments  available  for  options  when  the  form
3782              `--opt=val' is valid.  It is also possible to provide  hints  by
3783              examining  the  help  text of the command and adding helpspec of
3784              the form `pattern:message:action'; note  that  other  _arguments
3785              spec  forms  are  not  used.  The pattern is matched against the
3786              help text for an option, and  if  it  matches  the  message  and
3787              action  are  used as for other argument specifiers.  The special
3788              case of `*:' means both message and action are empty, which  has
3789              the  effect of causing options having no description in the help
3790              output to be ordered in listings ahead of options  that  have  a
3791              description.
3792
3793              For example:
3794
3795                     _arguments -- '*\*:toggle:(yes no)' \
3796                                   '*=FILE*:file:_files' \
3797                                   '*=DIR*:directory:_files -/' \
3798                                   '*=PATH*:directory:_files -/'
3799
3800              Here,  `yes'  and  `no'  will  be  completed  as the argument of
3801              options whose description ends in a star;  file  names  will  be
3802              completed  for options that contain the substring `=FILE' in the
3803              description; and directories will be completed for options whose
3804              description  contains  `=DIR' or `=PATH'.  The last three are in
3805              fact the default and so need not be given  explicitly,  although
3806              it is possible to override the use of these patterns.  A typical
3807              help text which uses this feature is:
3808
3809                       -C, --directory=DIR          change to directory DIR
3810
3811              so that the above specifications will cause  directories  to  be
3812              completed after `--directory', though not after `-C'.
3813
3814              Note also that _arguments tries to find out automatically if the
3815              argument for an option  is  optional.   This  can  be  specified
3816              explicitly by doubling the colon before the message.
3817
3818              If the pattern ends in `(-)', this will be removed from the pat‐
3819              tern and the action will be used only directly  after  the  `=',
3820              not  in the next word.  This is the behaviour of a normal speci‐
3821              fication defined with the form `=-'.
3822
3823              By default, the command (with the option `--help') is run  after
3824              resetting  all  the  locale  categories (except for LC_CTYPE) to
3825              `C'.  If the localized help output is known to work, the  option
3826              `-l' can be specified after the `_arguments --' so that the com‐
3827              mand is run in the current locale.
3828
3829              The `_arguments --' can be followed by the option `-i  patterns'
3830              to give patterns for options which are not to be completed.  The
3831              patterns can be given as the name of an array parameter or as  a
3832              literal list in parentheses.  For example,
3833
3834                     _arguments -- -i \
3835                         "(--(en|dis)able-FEATURE*)"
3836
3837              will  cause  completion to ignore the options `--enable-FEATURE'
3838              and `--disable-FEATURE' (this example is useful with GNU config‐
3839              ure).
3840
3841              The  `_arguments --' form can also be followed by the option `-s
3842              pair' to describe option aliases.  The pair consists of  a  list
3843              of alternating patterns and corresponding replacements, enclosed
3844              in parens and quoted so that it forms a single argument word  in
3845              the _arguments call.
3846
3847              For example, some configure-script help output describes options
3848              only as `--enable-foo', but the script also accepts the  negated
3849              form `--disable-foo'.  To allow completion of the second form:
3850
3851                     _arguments -- -s "((#s)--enable- --disable-)"
3852
3853              Miscellaneous notes
3854
3855              Finally,  note  that _arguments generally expects to be the pri‐
3856              mary function handling any completion for which it is used.   It
3857              may  have side effects which change the treatment of any matches
3858              added by other functions called after it.  To combine _arguments
3859              with  other  functions,  those functions should be called either
3860              before _arguments, as an action within a spec,  or  in  handlers
3861              for `->state' actions.
3862
3863              Here is a more general example of the use of _arguments:
3864
3865                     _arguments '-l+:left border:' \
3866                                '-format:paper size:(letter A4)' \
3867                                '*-copy:output file:_files::resolution:(300 600)' \
3868                                ':postscript file:_files -g \*.\(ps\|eps\)' \
3869                                '*:page number:'
3870
3871              This describes three options: `-l', `-format', and `-copy'.  The
3872              first takes one argument described as `left border' for which no
3873              completion  will  be  offered  because of the empty action.  Its
3874              argument may come directly after the `-l' or it may be given  as
3875              the next word on the line.
3876
3877              The  `-format'  option  takes  one  argument  in  the next word,
3878              described as `paper size' for which only  the  strings  `letter'
3879              and `A4' will be completed.
3880
3881              The `-copy' option may appear more than once on the command line
3882              and takes two arguments.  The first is  mandatory  and  will  be
3883              completed as a filename.  The second is optional (because of the
3884              second colon before the description `resolution')  and  will  be
3885              completed from the strings `300' and `600'.
3886
3887              The  last two descriptions say what should be completed as argu‐
3888              ments.  The first describes the first argument as a  `postscript
3889              file' and makes files ending in `ps' or `eps' be completed.  The
3890              last description gives all other arguments the description `page
3891              numbers' but does not offer completions.
3892
3893       _cache_invalid cache_identifier
3894              This  function returns status zero if the completions cache cor‐
3895              responding to the given cache identifier needs  rebuilding.   It
3896              determines  this  by  looking  up the cache-policy style for the
3897              current context.  This should provide a function name  which  is
3898              run  with  the  full path to the relevant cache file as the only
3899              argument.
3900
3901              Example:
3902
3903                     _example_caching_policy () {
3904                         # rebuild if cache is more than a week old
3905                         local -a oldp
3906                         oldp=( "$1"(Nm+7) )
3907                         (( $#oldp ))
3908                     }
3909
3910       _call_function return name [ arg ... ]
3911              If a function name exists, it is called with the arguments args.
3912              The  return  argument gives the name of a parameter in which the
3913              return status from the function name should be stored; if return
3914              is empty or a single hyphen it is ignored.
3915
3916              The  return status of _call_function itself is zero if the func‐
3917              tion name exists and was called and non-zero otherwise.
3918
3919       _call_program [ -l ] [ -p ] tag string ...
3920              This function provides a mechanism for the user to override  the
3921              use  of an external command.  It looks up the command style with
3922              the supplied tag.  If the style is set, its value is used as the
3923              command to execute.  The strings from the call to _call_program,
3924              or from the style if set, are concatenated with  spaces  between
3925              them  and  the resulting string is evaluated.  The return status
3926              is the return status of the command called.
3927
3928              By default, the command is run in an environment where  all  the
3929              locale  categories  (except  for  LC_CTYPE)  are reset to `C' by
3930              calling the utility function _comp_locale (see  below).  If  the
3931              option  `-l'  is  given,  the  command  is  run with the current
3932              locale.
3933
3934              If the option `-p' is supplied it  indicates  that  the  command
3935              output  is  influenced by the permissions it is run with. If the
3936              gain-privileges style is set to true,  _call_program  will  make
3937              use of commands such as sudo, if present on the command-line, to
3938              match the permissions to whatever the final command is likely to
3939              run  under.  When  looking  up  the  gain-privileges and command
3940              styles, the command component of the  zstyle  context  will  end
3941              with a slash (`/') followed by the command that would be used to
3942              gain privileges.
3943
3944       _combination [ -s pattern ] tag style spec ... field opts ...
3945              This function is used to complete combinations of  values,   for
3946              example  pairs  of  hostnames and usernames.  The style argument
3947              gives the style which defines the pairs; it is looked  up  in  a
3948              context with the tag specified.
3949
3950              The style name consists of field names separated by hyphens, for
3951              example `users-hosts-ports'.  For each  field  for  a  value  is
3952              already known, a spec of the form `field=pattern' is given.  For
3953              example, if the command line so far specifies a user `pws',  the
3954              argument `users=pws' should appear.
3955
3956              The  next  argument  with no equals sign is taken as the name of
3957              the field for which completions should be generated  (presumably
3958              not one of the fields for which the value is known).
3959
3960              The matches generated will be taken from the value of the style.
3961              These should contain the possible values for the combinations in
3962              the  appropriate  order  (users,  hosts,  ports  in  the example
3963              above).  The values for the different fields  are  separated  by
3964              colons.   This can be altered with the option -s to _combination
3965              which specifies a pattern.  Typically this is a character class,
3966              as for example `-s "[:@]"' in the case of the users-hosts style.
3967              Each `field=pattern'  specification  restricts  the  completions
3968              which apply to elements of the style with appropriately matching
3969              fields.
3970
3971              If no style with the given name is defined for the given tag, or
3972              if  none  of  the strings in style's value match, but a function
3973              name of the required field preceded by an underscore is defined,
3974              that function will be called to generate the matches.  For exam‐
3975              ple, if there is no `users-hosts-ports' or no matching  hostname
3976              when  a  host  is required, the function `_hosts' will automati‐
3977              cally be called.
3978
3979              If the same name is used for more than one field,  in  both  the
3980              `field=pattern'  and  the  argument  that  gives the name of the
3981              field to be completed, the number of the  field  (starting  with
3982              one)  may  be  given after the fieldname, separated from it by a
3983              colon.
3984
3985              All arguments after the required field name are passed  to  com‐
3986              padd  when  generating  matches  from the style value, or to the
3987              functions for the fields if they are called.
3988
3989       _command_names [ -e | - ]
3990              This function completes words that are valid  at  command  posi‐
3991              tion:  names  of  aliases, builtins, hashed commands, functions,
3992              and so on.  With the -e flag,  only  hashed  commands  are  com‐
3993              pleted.  The - flag is ignored.
3994
3995       _comp_locale
3996              This  function  resets  all  the  locale  categories  other than
3997              LC_CTYPE to `C' so that the output from external commands can be
3998              easily  analyzed  by the completion system. LC_CTYPE retains the
3999              current value (taking LC_ALL and LANG  into  account),  ensuring
4000              that  non-ASCII characters in file names are still handled prop‐
4001              erly.
4002
4003              This function should normally be run only in a subshell, because
4004              the  new  locale  is  exported to the environment. Typical usage
4005              would be `$(_comp_locale; command ...)'.
4006
4007       _completers [ -p ]
4008              This function completes names of completers.
4009
4010              -p     Include the leading underscore (`_') in the matches.
4011
4012
4013       _describe [-12JVx] [ -oO | -t tag ] descr name1 [ name2 ] [ opt ... ]
4014                 [ -- name1 [ name2 ] [ opt ... ] ... ]
4015              This function associates completions with descriptions.   Multi‐
4016              ple  groups  separated  by  -- can be supplied, potentially with
4017              different completion options opts.
4018
4019              The descr is taken as a string to display above the  matches  if
4020              the  format style for the descriptions tag is set.  This is fol‐
4021              lowed by one or two names of arrays followed by options to  pass
4022              to  compadd.   The array name1 contains the possible completions
4023              with their descriptions in  the  form  `completion:description'.
4024              Any  literal  colons  in  completion must be quoted with a back‐
4025              slash.  If a name2 is given, it should have the same  number  of
4026              elements  as  name1; in this case the corresponding elements are
4027              added as possible completions instead of the completion  strings
4028              from  name1.   The  completion list will retain the descriptions
4029              from name1.  Finally, a set of completion options can appear.
4030
4031              If the option  `-o'  appears  before  the  first  argument,  the
4032              matches  added will be treated as names of command options (N.B.
4033              not shell options), typically following a `-', `--'  or  `+'  on
4034              the  command  line.  In this case _describe uses the prefix-hid‐
4035              den, prefix-needed and verbose styles to find out if the strings
4036              should be added as completions and if the descriptions should be
4037              shown.  Without the `-o' option, only the verbose style is  used
4038              to  decide  how descriptions are shown.  If `-O' is used instead
4039              of `-o', command options are completed as  above  but  _describe
4040              will not handle the prefix-needed style.
4041
4042              With the -t option a tag can be specified.  The default is `val‐
4043              ues' or, if the -o option is given, `options'.
4044
4045              The options -1, -2, -J, -V, -x are passed to _next_label.
4046
4047              If selected by the list-grouped style,  strings  with  the  same
4048              description will appear together in the list.
4049
4050              _describe uses the _all_labels function to generate the matches,
4051              so it does not need to appear inside a loop over tag labels.
4052
4053       _description [ -x ] [ -12VJ ] tag name descr [ spec ... ]
4054              This function is not to be confused with the previous one; it is
4055              used  as  a helper function for creating options to compadd.  It
4056              is buried inside many of the higher level  completion  functions
4057              and so often does not need to be called directly.
4058
4059              The  styles listed below are tested in the current context using
4060              the given tag.  The resulting options for compadd are  put  into
4061              the  array  named  name  (this is traditionally `expl', but this
4062              convention is not enforced).  The  description  for  the  corre‐
4063              sponding set of matches is passed to the function in descr.
4064
4065              The  styles  tested  are:  format, hidden, matcher, ignore-line,
4066              ignored-patterns, group-name and  sort.   The  format  style  is
4067              first tested for the given tag and then for the descriptions tag
4068              if no value was found, while the remainder are only  tested  for
4069              the  tag  given  as the first argument.  The function also calls
4070              _setup which tests some more styles.
4071
4072              The string returned by the format style (if any) will  be  modi‐
4073              fied so that the sequence `%d' is replaced by the descr given as
4074              the third argument without any leading or trailing white  space.
4075              If,  after  removing  the  white  space,  the descr is the empty
4076              string, the format style will not be used and  the  options  put
4077              into the name array will not contain an explanation string to be
4078              displayed above the matches.
4079
4080              If _description is called with more than  three  arguments,  the
4081              additional specs should be of the form `char:str'.  These supply
4082              escape sequence replacements for the format style: every appear‐
4083              ance of `%char' will be replaced by string.
4084
4085              If  the  -x  option  is given, the description will be passed to
4086              compadd using the -x option instead of  the  default  -X.   This
4087              means  that  the description will be displayed even if there are
4088              no corresponding matches.
4089
4090              The options placed  in  the  array  name  take  account  of  the
4091              group-name  style,  so  matches  are  placed in a separate group
4092              where necessary.  The group normally has its elements sorted (by
4093              passing  the  option  -J  to compadd), but if an option starting
4094              with `-V', `-J', `-1', or `-2' is passed to  _description,  that
4095              option  will be included in the array.  Hence it is possible for
4096              the completion group to be unsorted by giving the  option  `-V',
4097              `-1V', or `-2V'.
4098
4099              In most cases, the function will be used like this:
4100
4101                     local expl
4102                     _description files expl file
4103                     compadd "$expl[@]" - "$files[@]"
4104
4105              Note  the use of the parameter expl, the hyphen, and the list of
4106              matches.  Almost all calls to compadd within the completion sys‐
4107              tem  use  a  similar  format;  this  ensures that user-specified
4108              styles are correctly passed down to the builtins which implement
4109              the internals of completion.
4110
4111       _dir_list [ -s sep ] [ -S ]
4112              Complete a list of directory names separated by colons (the same
4113              format as $PATH).
4114
4115              -s sep Use sep as separator between items.  sep  defaults  to  a
4116                     colon (`:').
4117
4118              -S     Add  sep instead of slash (`/') as an autoremoveable suf‐
4119                     fix.
4120
4121       _dispatch context string ...
4122              This sets the current context to context and looks  for  comple‐
4123              tion  functions  to  handle  this context by hunting through the
4124              list of command names or special contexts  (as  described  above
4125              for compdef) given as strings.  The first completion function to
4126              be defined for one of the contexts in the list is used to gener‐
4127              ate  matches.   Typically, the last string is -default- to cause
4128              the function for default completion to be used as a fallback.
4129
4130              The function sets the parameter $service  to  the  string  being
4131              tried,  and  sets  the context/command field (the fourth) of the
4132              $curcontext parameter to the context given as  the  first  argu‐
4133              ment.
4134
4135       _email_addresses [ -c ] [ -n plugin ]
4136              Complete email addresses.  Addresses are provided by plugins.
4137
4138              -c     Complete  bare  localhost@domain.tld addresses, without a
4139                     name part or a  comment.   Without  this  option,  RFC822
4140                     `Firstname Lastname <address>' strings are completed.
4141
4142              -n plugin
4143                     Complete aliases from plugin.
4144
4145              The following plugins are available by default: _email-ldap (see
4146              the filter style), _email-local  (completes  user@hostname  Unix
4147              addresses),  _email-mail  (completes  aliases  from  ~/.mailrc),
4148              _email-mush, _email-mutt, and _email-pine.
4149
4150              Addresses from the _email-foo plugin are  added  under  the  tag
4151              `email-foo'.
4152
4153              Writing plugins
4154
4155              Plugins  are  written  as separate functions with names starting
4156              with `_email-'.  They are invoked with the -c option and compadd
4157              options.   They should either do their own completion or set the
4158              $reply array to a list of `alias:address'  elements  and  return
4159              300.  New plugins will be picked up and run automatically.
4160
4161       _files The function _files is a wrapper around _path_files. It supports
4162              all  of  the  same  functionality,  with  some  enhancements  --
4163              notably,  it  respects  the list-dirs-first style, and it allows
4164              users to override the behaviour of the -g and  -/  options  with
4165              the  file-patterns  style.  _files should therefore be preferred
4166              over _path_files in most cases.
4167
4168              This function  accepts  the  full  set  of  options  allowed  by
4169              _path_files, described below.
4170
4171       _gnu_generic
4172              This function is a simple wrapper around the _arguments function
4173              described above.  It can be used to determine automatically  the
4174              long  options  understood  by  commands that produce a list when
4175              passed the option `--help'.  It is intended  to  be  used  as  a
4176              top-level completion function in its own right.  For example, to
4177              enable option completion for the commands foo and bar, use
4178
4179                     compdef _gnu_generic foo bar
4180
4181              after the call to compinit.
4182
4183              The completion system as supplied is conservative in its use  of
4184              this  function,  since  it  is  important to be sure the command
4185              understands the option `--help'.
4186
4187       _guard [ options ] pattern descr
4188              This function displays descr if pattern matches the string to be
4189              completed.   It  is  intended  to  be used in the action for the
4190              specifications passed to _arguments and similar functions.
4191
4192              The return status is zero if the message was displayed  and  the
4193              word to complete is not empty, and non-zero otherwise.
4194
4195              The  pattern may be preceded by any of the options understood by
4196              compadd that are passed down from _description, namely  -M,  -J,
4197              -V,  -1,  -2,  -n,  -F  and  -X.   All  of these options will be
4198              ignored.  This fits in conveniently  with  the  argument-passing
4199              conventions of actions for _arguments.
4200
4201              As  an  example,  consider  a  command taking the options -n and
4202              -none, where -n must be followed by a numeric value in the  same
4203              word.  By using:
4204
4205                     _arguments '-n-: :_guard "[0-9]#" "numeric value"' '-none'
4206
4207              _arguments  can  be  made  to  both display the message `numeric
4208              value' and complete options after `-n<TAB>'.   If  the  `-n'  is
4209              already  followed  by  one or more digits (the pattern passed to
4210              _guard) only the message will be displayed; if the `-n' is  fol‐
4211              lowed by another character, only options are completed.
4212
4213       _message [ -r12 ] [ -VJ group ] descr
4214       _message -e [ tag ] descr
4215              The  descr  is used in the same way as the third argument to the
4216              _description function, except that  the  resulting  string  will
4217              always  be shown whether or not matches were generated.  This is
4218              useful for displaying a help message in places where no  comple‐
4219              tions can be generated.
4220
4221              The  format  style  is  examined with the messages tag to find a
4222              message; the usual tag, descriptions, is used only if the  style
4223              is not set with the former.
4224
4225              If  the -r option is given, no style is used; the descr is taken
4226              literally as the string to display.  This is  most  useful  when
4227              the descr comes from a pre-processed argument list which already
4228              contains an expanded description.  Note that  this  option  does
4229              not disable the `%'-sequence parsing done by compadd.
4230
4231              The  -12VJ options and the group are passed to compadd and hence
4232              determine the group the message string is added to.
4233
4234              The second -e form gives a description for completions with  the
4235              tag  tag  to be shown even if there are no matches for that tag.
4236              This form is called by _arguments in the event that there is  no
4237              action  for an option specification.  The tag can be omitted and
4238              if so the tag is taken from the parameter $curtag; this is main‐
4239              tained by the completion system and so is usually correct.  Note
4240              that if there are no  matches  at  the  time  this  function  is
4241              called, compstate[insert] is cleared, so additional matches gen‐
4242              erated later are not inserted on the command line.
4243
4244       _multi_parts [ -i ] sep array
4245              The argument sep is a separator character.   The  array  may  be
4246              either  the name of an array parameter or a literal array in the
4247              form `(foo bar)', a parenthesised list  of  words  separated  by
4248              whitespace.   The  possible completions are the strings from the
4249              array.  However, each chunk delimited by sep will  be  completed
4250              separately.  For example, the _tar function uses `_multi_parts /
4251              patharray' to complete partial file paths from the  given  array
4252              of complete file paths.
4253
4254              The  -i option causes _multi_parts to insert a unique match even
4255              if that requires multiple separators to be  inserted.   This  is
4256              not  usually  the expected behaviour with filenames, but certain
4257              other types of completion, for example those with a fixed set of
4258              possibilities, may be more suited to this form.
4259
4260              Like  other  utility  functions, this function accepts the `-V',
4261              `-J', `-1', `-2', `-n', `-f',  `-X',  `-M',  `-P',  `-S',  `-r',
4262              `-R', and `-q' options and passes them to the compadd builtin.
4263
4264       _next_label [ -x ] [ -12VJ ] tag name descr [ option ... ]
4265              This  function  is used to implement the loop over different tag
4266              labels for a particular tag as described above for the tag-order
4267              style.   On each call it checks to see if there are any more tag
4268              labels; if there is it returns status zero, otherwise  non-zero.
4269              As  this  function  requires  a  current  tag to be set, it must
4270              always follow a call to _tags or _requested.
4271
4272              The -x12VJ options and the first three arguments are  passed  to
4273              the  _description  function.   Where appropriate the tag will be
4274              replaced by a tag label in this call.  Any description given  in
4275              the  tag-order  style  is  preferred  to  the  descr  passed  to
4276              _next_label.
4277
4278              The options given after the descr are set in the parameter given
4279              by name, and hence are to be passed to compadd or whatever func‐
4280              tion is called to add the matches.
4281
4282              Here is a typical use of this function for  the  tag  foo.   The
4283              call to _requested determines if tag foo is required at all; the
4284              loop over _next_label handles any labels defined for the tag  in
4285              the tag-order style.
4286
4287                     local expl ret=1
4288                     ...
4289                     if _requested foo; then
4290                       ...
4291                       while _next_label foo expl '...'; do
4292                         compadd "$expl[@]" ... && ret=0
4293                       done
4294                       ...
4295                     fi
4296                     return ret
4297
4298       _normal [ -P | -p precommand ]
4299              This  is  the standard function called to handle completion out‐
4300              side any special -context-.  It is called both to  complete  the
4301              command  word and also the arguments for a command.  In the sec‐
4302              ond case, _normal looks for a special completion for  that  com‐
4303              mand,  and  if  there  is  none  it  uses the completion for the
4304              -default- context.
4305
4306              A second use is to reexamine the command line specified  by  the
4307              $words  array  and  the $CURRENT parameter after those have been
4308              modified.  For example, the  function  _precommand,  which  com‐
4309              pletes  after  precommand  specifiers such as nohup, removes the
4310              first word from the words array, decrements the CURRENT  parame‐
4311              ter,  then  calls  `_normal  -p  $service'.   The effect is that
4312              `nohup cmd ...' is treated in the same way as `cmd ...'.
4313
4314              -P     Reset the list of precommands. This option should be used
4315                     if  completing  a command line which allows internal com‐
4316                     mands (e.g. builtins and functions) regardless  of  prior
4317                     precommands (e.g. `zsh -c').
4318
4319              -p precommand
4320                     Append precommand to the list of precommands. This option
4321                     should be used in nearly all cases in  which  -P  is  not
4322                     applicable.
4323
4324              If  the command name matches one of the patterns given by one of
4325              the options -p or -P to compdef,  the  corresponding  completion
4326              function  is called and then the parameter _compskip is checked.
4327              If it is set completion is terminated at that point even  if  no
4328              matches  have  been  found.   This  is the same effect as in the
4329              -first- context.
4330
4331       _options
4332              This can be used to complete the names  of  shell  options.   It
4333              provides  a  matcher  specification that ignores a leading `no',
4334              ignores underscores and allows upper-case letters to match their
4335              lower-case   counterparts   (for   example,   `glob',  `noglob',
4336              `NO_GLOB' are all completed).  Any arguments are  propagated  to
4337              the compadd builtin.
4338
4339       _options_set and _options_unset
4340              These  functions  complete  only  set or unset options, with the
4341              same matching specification used in the _options function.
4342
4343              Note that you need to uncomment a few lines  in  the  _main_com‐
4344              plete  function for these functions to work properly.  The lines
4345              in question are used to store  the  option  settings  in  effect
4346              before  the completion widget locally sets the options it needs.
4347              Hence these functions are not generally used by  the  completion
4348              system.
4349
4350       _parameters
4351              This is used to complete the names of shell parameters.
4352
4353              The  option  `-g  pattern'  limits  the completion to parameters
4354              whose type matches the pattern.  The type of a parameter is that
4355              shown by `print ${(t)param}', hence judicious use of `*' in pat‐
4356              tern is probably necessary.
4357
4358              All other arguments are passed to the compadd builtin.
4359
4360       _path_files
4361              This function is used throughout the completion system  to  com‐
4362              plete  filenames.   It  allows completion of partial paths.  For
4363              example,  the  string   `/u/i/s/sig'   may   be   completed   to
4364              `/usr/include/sys/signal.h'.
4365
4366              The options accepted by both _path_files and _files are:
4367
4368              -f     Complete all filenames.  This is the default.
4369
4370              -/     Specifies that only directories should be completed.
4371
4372              -g pattern
4373                     Specifies  that only files matching the pattern should be
4374                     completed.
4375
4376              -W paths
4377                     Specifies path prefixes that are to be prepended  to  the
4378                     string  from  the  command line to generate the filenames
4379                     but that should not be inserted as completions nor  shown
4380                     in  completion  listings.  Here, paths may be the name of
4381                     an array parameter, a literal list of paths  enclosed  in
4382                     parentheses or an absolute pathname.
4383
4384              -F ignored-files
4385                     This  behaves as for the corresponding option to the com‐
4386                     padd builtin.  It gives direct control over  which  file‐
4387                     names  should  be ignored.  If the option is not present,
4388                     the ignored-patterns style is used.
4389
4390              Both _path_files and _files also accept  the  following  options
4391              which are passed to compadd: `-J', `-V', `-1', `-2', `-n', `-X',
4392              `-M', `-P', `-S', `-q', `-r', and `-R'.
4393
4394              Finally, the  _path_files  function   uses  the  styles  expand,
4395              ambiguous,  special-dirs,  list-suffixes and file-sort described
4396              above.
4397
4398
4399       _pick_variant [ -b builtin-label ] [ -c command ] [ -r name ]
4400                     label=pattern ... label [ arg ... ]
4401              This function is used to resolve situations where a single  com‐
4402              mand  name  requires  more  than  one  type  of handling, either
4403              because it has more than one variant or because there is a  name
4404              clash between two different commands.
4405
4406              The  command to run is taken from the first element of the array
4407              words unless this is overridden by the option -c.  This  command
4408              is  run  and  its  output is compared with a series of patterns.
4409              Arguments to be passed to the command can be  specified  at  the
4410              end after all the other arguments.  The patterns to try in order
4411              are given by the arguments label=pattern; if the output of `com‐
4412              mand  arg  ...'  contains pattern, then label is selected as the
4413              label for the command variant.  If none of the  patterns  match,
4414              the final command label is selected and status 1 is returned.
4415
4416              If the `-b builtin-label' is given, the command is tested to see
4417              if it is provided as a shell builtin,  possibly  autoloaded;  if
4418              so,  the  label  builtin-label  is selected as the label for the
4419              variant.
4420
4421              If the `-r name' is given, the label picked  is  stored  in  the
4422              parameter named name.
4423
4424              The  results  are  also  cached  in the _cmd_variant associative
4425              array indexed by the name of the command run.
4426
4427       _regex_arguments name spec ...
4428              This function generates a completion function name which matches
4429              the  specifications  specs,  a  set  of  regular  expressions as
4430              described below.  After running _regex_arguments,  the  function
4431              name should be called as a normal completion function.  The pat‐
4432              tern to be matched is given by the contents of the  words  array
4433              up  to  the  current  cursor  position joined together with null
4434              characters; no quotation is applied.
4435
4436              The arguments are grouped as sets of alternatives  separated  by
4437              `|',  which  are  tried  one  after the other until one matches.
4438              Each alternative consists of a one or more specifications  which
4439              are  tried  left  to  right,  with  each  pattern  matched being
4440              stripped in turn from the command line being tested,  until  all
4441              of  the  group  succeeds or until one fails; in the latter case,
4442              the next alternative is tried.  This structure can  be  repeated
4443              to  arbitrary depth by using parentheses; matching proceeds from
4444              inside to outside.
4445
4446              A special procedure is applied  if  no  test  succeeds  but  the
4447              remaining command line string contains no null character (imply‐
4448              ing the remaining word is the one for which completions  are  to
4449              be  generated).   The  completion  target  is  restricted to the
4450              remaining word and any actions for  the  corresponding  patterns
4451              are  executed.   In this case, nothing is stripped from the com‐
4452              mand line string.  The order of evaluation of the actions can be
4453              determined by the tag-order style; the various formats supported
4454              by _alternative can be used in action.  The descr  is  used  for
4455              setting up the array parameter expl.
4456
4457              Specification  arguments  take  one of following forms, in which
4458              metacharacters such as `(', `)', `#' and `|' should be quoted.
4459
4460              /pattern/ [%lookahead%] [-guard] [:tag:descr:action]
4461                     This is a single primitive component.  The function tests
4462                     whether  the  combined  pattern  `(#b)((#B)pattern)looka‐
4463                     head*' matches the command line string.  If  so,  `guard'
4464                     is  evaluated and its return status is examined to deter‐
4465                     mine if the test has succeeded.  The pattern string  `[]'
4466                     is  guaranteed  never  to  match.   The  lookahead is not
4467                     stripped from the command line before the next pattern is
4468                     examined.
4469
4470                     The  argument  starting with : is used in the same manner
4471                     as an argument to _alternative.
4472
4473                     A component is used as follows: pattern is tested to  see
4474                     if  the component already exists on the command line.  If
4475                     it does, any following  specifications  are  examined  to
4476                     find  something  to  complete.  If a component is reached
4477                     but no such pattern exists yet on the command  line,  the
4478                     string  containing the action is used to generate matches
4479                     to insert at that point.
4480
4481              /pattern/+ [%lookahead%] [-guard] [:tag:descr:action]
4482                     This is similar to `/pattern/ ...' but the left  part  of
4483                     the command line string (i.e. the part already matched by
4484                     previous patterns) is also considered part of the comple‐
4485                     tion target.
4486
4487              /pattern/- [%lookahead%] [-guard] [:tag:descr:action]
4488                     This is similar to `/pattern/ ...' but the actions of the
4489                     current and previously matched patterns are ignored  even
4490                     if the following `pattern' matches the empty string.
4491
4492              ( spec )
4493                     Parentheses may be used to groups specs; note each paren‐
4494                     thesis is a single argument to _regex_arguments.
4495
4496              spec # This allows any number of repetitions of spec.
4497
4498              spec spec
4499                     The two specs are to be matched one after  the  other  as
4500                     described above.
4501
4502              spec | spec
4503                     Either of the two specs can be matched.
4504
4505              The  function  _regex_words  can be used as a helper function to
4506              generate matches for a set of alternative  words  possibly  with
4507              their own arguments as a command line argument.
4508
4509              Examples:
4510
4511                     _regex_arguments _tst /$'[^\0]#\0'/ \
4512                         /$'[^\0]#\0'/ :'compadd aaa'
4513
4514              This  generates  a  function _tst that completes aaa as its only
4515              argument.  The tag and description  for  the  action  have  been
4516              omitted for brevity (this works but is not recommended in normal
4517              use).  The first component matches the command  word,  which  is
4518              arbitrary; the second matches  any argument.  As the argument is
4519              also arbitrary, any following component would not depend on  aaa
4520              being present.
4521
4522                     _regex_arguments _tst /$'[^\0]#\0'/ \
4523                         /$'aaa\0'/ :'compadd aaa'
4524
4525              This  is  a  more  typical use; it is similar, but any following
4526              patterns would only match if aaa was present as the first  argu‐
4527              ment.
4528
4529                     _regex_arguments _tst /$'[^\0]#\0'/ \( \
4530                         /$'aaa\0'/ :'compadd aaa' \
4531                         /$'bbb\0'/ :'compadd bbb' \) \#
4532
4533              In  this  example, an indefinite number of command arguments may
4534              be completed.  Odd arguments are completed as aaa and even argu‐
4535              ments  as  bbb.   Completion fails unless the set of aaa and bbb
4536              arguments before the current one is matched correctly.
4537
4538                     _regex_arguments _tst /$'[^\0]#\0'/ \
4539                         \( /$'aaa\0'/ :'compadd aaa' \| \
4540                         /$'bbb\0'/ :'compadd bbb' \) \#
4541
4542              This is similar, but either aaa or bbb may be completed for  any
4543              argument.  In this case _regex_words could be used to generate a
4544              suitable expression for the arguments.
4545
4546       _regex_words tag description spec ...
4547              This  function  can  be  used  to  generate  arguments  for  the
4548              _regex_arguments  command  which  may  be  inserted at any point
4549              where a set of rules is expected.  The tag and description  give
4550              a  standard  tag  and description pertaining to the current con‐
4551              text.  Each spec contains two or three arguments separated by  a
4552              colon: note that there is no leading colon in this case.
4553
4554              Each  spec  gives one of a set of words that may be completed at
4555              this point, together with arguments.  It is thus roughly equiva‐
4556              lent  to the _arguments function when used in normal (non-regex)
4557              completion.
4558
4559              The part of the spec before the first colon is the  word  to  be
4560              completed.   This  may  contain a *; the entire word, before and
4561              after the * is completed, but only the  text  before  the  *  is
4562              required  for  the  context to be matched, so that further argu‐
4563              ments may be completed after the abbreviated form.
4564
4565              The second part of spec is a description for the word being com‐
4566              pleted.
4567
4568              The  optional third part of the spec describes how words follow‐
4569              ing the one being completed are themselves to be completed.   It
4570              will be evaluated in order to avoid problems with quoting.  This
4571              means that typically it contains a reference to  an  array  con‐
4572              taining previously generated regex arguments.
4573
4574              The  option  -t term specifies a terminator for the word instead
4575              of the usual space.  This is handled as an auto-removable suffix
4576              in the manner of the option -s sep to _values.
4577
4578              The  result  of  the processing by _regex_words is placed in the
4579              array reply, which should be made local to the calling function.
4580              If the set of words and arguments may be matched repeatedly, a #
4581              should be appended to the generated array at that point.
4582
4583              For example:
4584
4585                     local -a reply
4586                     _regex_words mydb-commands 'mydb commands' \
4587                       'add:add an entry to mydb:$mydb_add_cmds' \
4588                       'show:show entries in mydb'
4589                     _regex_arguments _mydb "$reply[@]"
4590                     _mydb "$@"
4591
4592              This shows a completion function for a command mydb which  takes
4593              two  command  arguments, add and show.  show takes no arguments,
4594              while the arguments for add have already  been  prepared  in  an
4595              array  mydb_add_cmds,  quite  possibly  by  a  previous  call to
4596              _regex_words.
4597
4598       _requested [ -x ] [ -12VJ ] tag [ name descr [ command [ arg ... ] ]
4599              This function is called to decide whether a tag  already  regis‐
4600              tered  by  a call to _tags (see below) has been requested by the
4601              user and hence  completion  should  be  performed  for  it.   It
4602              returns  status zero if the tag is requested and non-zero other‐
4603              wise.  The function is typically used as part  of  a  loop  over
4604              different tags as follows:
4605
4606                     _tags foo bar baz
4607                     while _tags; do
4608                       if _requested foo; then
4609                         ... # perform completion for foo
4610                       fi
4611                       ... # test the tags bar and baz in the same way
4612                       ... # exit loop if matches were generated
4613                     done
4614
4615              Note  that  the  test  for whether matches were generated is not
4616              performed until the end of the _tags loop.  This is so that  the
4617              user  can set the tag-order style to specify a set of tags to be
4618              completed at the same time.
4619
4620              If name and descr are given, _requested calls  the  _description
4621              function  with  these arguments together with the options passed
4622              to _requested.
4623
4624              If command is given, the _all_labels  function  will  be  called
4625              immediately with the same arguments.  In simple cases this makes
4626              it possible to perform the test for the tag and the matching  in
4627              one go.  For example:
4628
4629                     local expl ret=1
4630                     _tags foo bar baz
4631                     while _tags; do
4632                       _requested foo expl 'description' \
4633                           compadd foobar foobaz && ret=0
4634                       ...
4635                       (( ret )) || break
4636                     done
4637
4638              If  the command is not compadd, it must nevertheless be prepared
4639              to handle the same options.
4640
4641       _retrieve_cache cache_identifier
4642              This function retrieves completion  information  from  the  file
4643              given  by  cache_identifier,  stored in a directory specified by
4644              the cache-path  style  which  defaults  to  ~/.zcompcache.   The
4645              return status is zero if retrieval was successful.  It will only
4646              attempt retrieval if the use-cache style is set, so you can call
4647              this  function without worrying about whether the user wanted to
4648              use the caching layer.
4649
4650              See _store_cache below for more details.
4651
4652       _sep_parts
4653              This function is passed alternating  arrays  and  separators  as
4654              arguments.   The arrays specify completions for parts of strings
4655              to be separated by the separators.  The arrays may be the  names
4656              of  array  parameters  or a quoted list of words in parentheses.
4657              For  example,  with  the  array  `hosts=(ftp  news)'  the   call
4658              `_sep_parts  '(foo  bar)' @ hosts' will complete the string  `f'
4659              to `foo' and the string `b@n' to `bar@news'.
4660
4661              This function accepts the  compadd  options  `-V',  `-J',  `-1',
4662              `-2',  `-n',  `-X',  `-M',  `-P', `-S', `-r', `-R', and `-q' and
4663              passes them on to the compadd builtin used to add the matches.
4664
4665       _sequence [ -s sep ] [ -n max ] [ -d ] function [ - ] ...
4666              This function is a wrapper to  other  functions  for  completing
4667              items in a separated list. The same function is used to complete
4668              each item in the list. The separator is specified  with  the  -s
4669              option.  If  -s is omitted it will use `,'. Duplicate values are
4670              not matched unless -d is specified. If there is a fixed or maxi‐
4671              mum  number of items in the list, this can be specified with the
4672              -n option.
4673
4674              Common compadd options are passed on to the function. It is pos‐
4675              sible to use compadd directly with _sequence, though _values may
4676              be more appropriate in this situation.
4677
4678       _setup tag [ group ]
4679              This function sets up the special parameters used by the comple‐
4680              tion  system  appropriately for the tag given as the first argu‐
4681              ment.    It   uses   the   styles   list-colors,    list-packed,
4682              list-rows-first, last-prompt, accept-exact, menu and force-list.
4683
4684              The  optional  group supplies the name of the group in which the
4685              matches will be placed.  If it is not given, the tag is used  as
4686              the group name.
4687
4688              This  function  is  called  automatically  from _description and
4689              hence is not normally called explicitly.
4690
4691       _store_cache cache_identifier param ...
4692              This function, together with _retrieve_cache and _cache_invalid,
4693              implements  a  caching layer which can be used in any completion
4694              function.  Data obtained by  costly  operations  are  stored  in
4695              parameters; this function then dumps the values of those parame‐
4696              ters to a file.  The data can then  be  retrieved  quickly  from
4697              that  file  via  _retrieve_cache, even in different instances of
4698              the shell.
4699
4700              The cache_identifier specifies the file which the data should be
4701              dumped  to.   The file is stored in a directory specified by the
4702              cache-path style which defaults to ~/.zcompcache.  The remaining
4703              params arguments are the parameters to dump to the file.
4704
4705              The  return status is zero if storage was successful.  The func‐
4706              tion will only attempt storage if the use-cache style is set, so
4707              you  can  call  this function without worrying about whether the
4708              user wanted to use the caching layer.
4709
4710              The completion function may avoid calling  _retrieve_cache  when
4711              it  already  has  the  completion  data available as parameters.
4712              However, in that case it should  call  _cache_invalid  to  check
4713              whether  the  data  in the parameters and in the cache are still
4714              valid.
4715
4716              See the _perl_modules completion function for a  simple  example
4717              of the usage of the caching layer.
4718
4719       _tags [ [ -C name ] tag ... ]
4720              If  called  with  arguments,  these are taken to be the names of
4721              tags valid for completions in the current context.   These  tags
4722              are stored internally and sorted by using the tag-order style.
4723
4724              Next, _tags is called repeatedly without arguments from the same
4725              completion function.  This successively selects the first,  sec‐
4726              ond,  etc. set of tags requested by the user.  The return status
4727              is zero if at least one of the tags is  requested  and  non-zero
4728              otherwise.   To  test  if  a  particular tag is to be tried, the
4729              _requested function should be called (see above).
4730
4731              If `-C name' is given, name is temporarily stored in  the  argu‐
4732              ment  field (the fifth) of the context in the curcontext parame‐
4733              ter during the call to _tags; the field  is  restored  on  exit.
4734              This  allows _tags to use a more specific context without having
4735              to change and reset the curcontext parameter (which has the same
4736              effect).
4737
4738       _tilde_files
4739              Like  _files,  but resolve leading tildes according to the rules
4740              of filename expansion, so the suggested completions don't  start
4741              with a `~' even if the filename on the command-line does.
4742
4743       _values [ -O name ] [ -s sep ] [ -S sep ] [ -wC ] desc spec ...
4744              This  is  used to complete arbitrary keywords (values) and their
4745              arguments, or lists of such combinations.
4746
4747              If the first argument is the option `-O name', it will  be  used
4748              in  the same way as by the _arguments function.  In other words,
4749              the elements of the name array will be passed  to  compadd  when
4750              executing an action.
4751
4752              If the first argument (or the first argument after `-O name') is
4753              `-s', the next argument is used as the character that  separates
4754              multiple  values.   This  character is automatically added after
4755              each value in an auto-removable fashion (see below); all  values
4756              completed by `_values -s' appear in the same word on the command
4757              line, unlike completion using _arguments.  If this option is not
4758              present, only a single value will be completed per word.
4759
4760              Normally,  _values  will  only use the current word to determine
4761              which values are already present on the command line  and  hence
4762              are not to be completed again.  If the -w option is given, other
4763              arguments are examined as well.
4764
4765              The first non-option argument, desc, is  used  as  a  string  to
4766              print as a description before listing the values.
4767
4768              All other arguments describe the possible values and their argu‐
4769              ments in the same format used for the description of options  by
4770              the  _arguments  function (see above).  The only differences are
4771              that no minus or plus sign is required at the beginning,  values
4772              can  have  only  one argument, and the forms of action beginning
4773              with an equal sign are not supported.
4774
4775              The character separating a value from its argument  can  be  set
4776              using  the  option -S (like -s, followed by the character to use
4777              as the separator in the next argument).  By default  the  equals
4778              sign will be used as the separator between values and arguments.
4779
4780              Example:
4781
4782                     _values -s , 'description' \
4783                             '*foo[bar]' \
4784                             '(two)*one[number]:first count:' \
4785                             'two[another number]::second count:(1 2 3)'
4786
4787              This  describes  three possible values: `foo', `one', and `two'.
4788              The first is described as  `bar',  takes  no  argument  and  may
4789              appear more than once.  The second is described as `number', may
4790              appear  more  than  once,  and  takes  one  mandatory   argument
4791              described  as  `first count'; no action is specified, so it will
4792              not be completed.  The `(two)' at the beginning says that if the
4793              value  `one'  is  on the line, the value `two' will no longer be
4794              considered a  possible  completion.   Finally,  the  last  value
4795              (`two')  is  described as `another number' and takes an optional
4796              argument described as `second count' for which  the  completions
4797              (to  appear  after  an  `=') are `1', `2', and `3'.  The _values
4798              function will complete lists of these values separated  by  com‐
4799              mas.
4800
4801              Like  _arguments, this function temporarily adds another context
4802              name component to the arguments element (the fifth) of the  cur‐
4803              rent context while executing the action.  Here this name is just
4804              the name of the value for which the argument is completed.
4805
4806              The style verbose is used to decide if the descriptions for  the
4807              values (but not those for the arguments) should be printed.
4808
4809              The  associative  array  val_args  is  used to report values and
4810              their arguments; this works similarly to the  opt_args  associa‐
4811              tive array used by _arguments.  Hence the function calling _val‐
4812              ues should declare  the  local  parameters  state,  state_descr,
4813              line, context and val_args:
4814
4815                     local context state state_descr line
4816                     typeset -A val_args
4817
4818              when using an action of the form `->string'.  With this function
4819              the context parameter will be set to the name of the value whose
4820              argument  is  to be completed.  Note that for _values, the state
4821              and state_descr are scalars rather than arrays.  Only  a  single
4822              matching state is returned.
4823
4824              Note  also  that _values normally adds the character used as the
4825              separator between values as an auto-removable suffix (similar to
4826              a  `/'  after a directory).  However, this is not possible for a
4827              `->string' action as the matches for the argument are  generated
4828              by  the calling function.  To get the usual behaviour, the call‐
4829              ing function can add the separator x as a suffix by passing  the
4830              options `-qS x' either directly or indirectly to compadd.
4831
4832              The option -C is treated in the same way as it is by _arguments.
4833              In that case the  parameter  curcontext  should  be  made  local
4834              instead of context (as described above).
4835
4836       _wanted [ -x ] [ -C name ]  [ -12VJ ] tag name descr command [ arg ...]
4837              In  many  contexts,  completion can only generate one particular
4838              set of matches, usually corresponding to a single tag.  However,
4839              it  is  still  necessary  to  decide  whether  the user requires
4840              matches of this type.  This function is useful in such a case.
4841
4842              The arguments to _wanted are the same as  those  to  _requested,
4843              i.e.  arguments  to be passed to _description.  However, in this
4844              case the command is not optional;  all the processing  of  tags,
4845              including the loop over both tags and tag labels and the genera‐
4846              tion of matches, is carried out automatically by _wanted.
4847
4848              Hence to offer only one tag and immediately add the  correspond‐
4849              ing matches with the given description:
4850
4851                     local expl
4852                     _wanted tag expl 'description' \
4853                         compadd matches...
4854
4855              Note that, as for _requested, the command must be able to accept
4856              options to be passed down to compadd.
4857
4858              Like _tags this function supports the -C option to give  a  dif‐
4859              ferent  name  for the argument context field.  The -x option has
4860              the same meaning as for _description.
4861
4862       _widgets [ -g pattern ]
4863              This function completes names of zle widgets  (see  the  section
4864              `Widgets'  in  zshzle(1)).   The pattern, if present, is matched
4865              against values of the $widgets special parameter, documented  in
4866              the section `The zsh/zleparameter Module' in zshmodules(1).
4867

COMPLETION SYSTEM VARIABLES

4869       There  are  some  standard variables, initialised by the _main_complete
4870       function and then used from other functions.
4871
4872       The standard variables are:
4873
4874       _comp_caller_options
4875              The completion system uses setopt to set a  number  of  options.
4876              This allows functions to be written without concern for compati‐
4877              bility with every possible combination of user options. However,
4878              sometimes  completion needs to know what the user's option pref‐
4879              erences are. These are saved in the  _comp_caller_options  asso‐
4880              ciative array. Option names, spelled in lowercase without under‐
4881              scores, are mapped to one or  other  of  the  strings  `on'  and
4882              `off'.
4883
4884              _comp_priv_prefix
4885                     Completion   functions   such   as   _sudo  can  set  the
4886                     _comp_priv_prefix array to a command prefix that may then
4887                     be  used  by  _call_program  to match the privileges when
4888                     calling programs to generate matches.
4889
4890              Two more features are offered by  the  _main_complete  function.
4891              The  arrays  compprefuncs and comppostfuncs may contain names of
4892              functions that are to be called immediately before or after com‐
4893              pletion  has  been  tried.   A function will only be called once
4894              unless it explicitly reinserts itself into the array.
4895

COMPLETION DIRECTORIES

4897       In the source distribution, the files are contained in  various  subdi‐
4898       rectories of the Completion directory.  They may have been installed in
4899       the same structure, or into one single function directory.  The follow‐
4900       ing  is  a  description  of  the  files found in the original directory
4901       structure.  If you wish to alter an installed file, you  will  need  to
4902       copy  it to some directory which appears earlier in your fpath than the
4903       standard directory where it appears.
4904
4905       Base   The core functions and special completion widgets  automatically
4906              bound  to  keys.   You will certainly need most of these, though
4907              will probably not need to alter them.  Many of these  are  docu‐
4908              mented above.
4909
4910       Zsh    Functions for completing arguments of shell builtin commands and
4911              utility functions for this.  Some of  these  are  also  used  by
4912              functions from the Unix directory.
4913
4914       Unix   Functions  for  completing  arguments  of  external commands and
4915              suites of commands.  They may need modifying  for  your  system,
4916              although in many cases some attempt is made to decide which ver‐
4917              sion of a command is present.  For example, completion  for  the
4918              mount  command  tries  to determine the system it is running on,
4919              while completion for many other utilities try to decide  whether
4920              the  GNU version of the command is in use, and hence whether the
4921              --help option is supported.
4922
4923       X, AIX, BSD, ...
4924              Completion and utility function for commands available  only  on
4925              some  systems.   These  are not arranged hierarchically, so, for
4926              example, both the Linux and Debian directories, as well as the X
4927              directory, may be useful on your system.
4928
4929
4930
4931zsh 5.8                        February 14, 2020                 ZSHCOMPSYS(1)
Impressum