This is zsh.info, produced by makeinfo version 4.2 from tzsh.texi.

INFO-DIR-SECTION Shells
START-INFO-DIR-ENTRY
* Zsh: (zsh).                  The Z shell.
END-INFO-DIR-ENTRY

INFO-DIR-SECTION Utilities
START-INFO-DIR-ENTRY
* ZSH: (zsh).                     The Z Shell Manual.
END-INFO-DIR-ENTRY


File: zsh.info,  Node: Modifying Text,  Next: Arguments,  Prev: History Control,  Up: Zle Widgets

Modifying Text
--------------

vi-add-eol (unbound) (A) (unbound)
     Move to the end of the line and enter insert mode.

vi-add-next (unbound) (a) (unbound)
     Enter insert mode after the current cursor position, without
     changing lines.

backward-delete-char (^H ^?) (unbound) (unbound)
     Delete the character behind the cursor.

vi-backward-delete-char (unbound) (X) (^H)
     Delete the character behind the cursor, without changing lines.
     If in insert mode, this won't delete past the point where insert
     mode was last entered.

backward-delete-word
     Delete the word behind the cursor.

backward-kill-line
     Kill from the beginning of the line to the cursor position.

backward-kill-word (^W ESC-^H ESC-^?) (unbound) (unbound)
     Kill the word behind the cursor.

vi-backward-kill-word (unbound) (unbound) (^W)
     Kill the word behind the cursor, without going past the point
     where insert mode was last entered.

capitalize-word (ESC-C ESC-c) (unbound) (unbound)
     Capitalize the current word and move past it.

vi-change (unbound) (c) (unbound)
     Read a movement command from the keyboard, and kill from the
     cursor position to the endpoint of the movement.  Then enter
     insert mode.  If the command is vi-change, change the current line.

vi-change-eol (unbound) (C) (unbound)
     Kill to the end of the line and enter insert mode.

vi-change-whole-line (unbound) (S) (unbound)
     Kill the current line and enter insert mode.

copy-region-as-kill (ESC-W ESC-w) (unbound) (unbound)
     Copy the area from the cursor to the mark to the kill buffer.

copy-prev-word (ESC-^_) (unbound) (unbound)
     Duplicate the word to the left of the cursor.

copy-prev-shell-word
     Like copy-prev-word, but the word is found by using shell parsing,
     whereas copy-prev-word looks for blanks. This makes a difference
     when the word is quoted and contains spaces.

vi-delete (unbound) (d) (unbound)
     Read a movement command from the keyboard, and kill from the
     cursor position to the endpoint of the movement.  If the command
     is vi-delete, kill the current line.

delete-char
     Delete the character under the cursor.

vi-delete-char (unbound) (x) (unbound)
     Delete the character under the cursor, without going past the end
     of the line.

delete-word
     Delete the current word.

down-case-word (ESC-L ESC-l) (unbound) (unbound)
     Convert the current word to all lowercase and move past it.

kill-word (ESC-D ESC-d) (unbound) (unbound)
     Kill the current word.

gosmacs-transpose-chars
     Exchange the two characters behind the cursor.

vi-indent (unbound) (>) (unbound)
     Indent a number of lines.

vi-insert (unbound) (i) (unbound)
     Enter insert mode.

vi-insert-bol (unbound) (I) (unbound)
     Move to the first non-blank character on the line and enter insert
     mode.

vi-join (^X^J) (J) (unbound)
     Join the current line with the next one.

kill-line (^K) (unbound) (unbound)
     Kill from the cursor to the end of the line.  If already on the
     end of the line, kill the newline character.

vi-kill-line (unbound) (unbound) (^U)
     Kill from the cursor back to wherever insert mode was last entered.

vi-kill-eol (unbound) (D) (unbound)
     Kill from the cursor to the end of the line.

kill-region
     Kill from the cursor to the mark.

kill-buffer (^X^K) (unbound) (unbound)
     Kill the entire buffer.

kill-whole-line (^U) (unbound) (unbound)
     Kill the current line.

vi-match-bracket (^X^B) (%) (unbound)
     Move to the bracket character (one of {}, () or []) that matches
     the one under the cursor.  If the cursor is not on a bracket
     character, move forward without going past the end of the line to
     find one, and then go to the matching bracket.

vi-open-line-above (unbound) (O) (unbound)
     Open a line above the cursor and enter insert mode.

vi-open-line-below (unbound) (o) (unbound)
     Open a line below the cursor and enter insert mode.

vi-oper-swap-case
     Read a movement command from the keyboard, and swap the case of
     all characters from the cursor position to the endpoint of the
     movement.  If the movement command is vi-oper-swap-case, swap the
     case of all characters on the current line.

overwrite-mode (^X^O) (unbound) (unbound)
     Toggle between overwrite mode and insert mode.

vi-put-before (unbound) (P) (unbound)
     Insert the contents of the kill buffer before the cursor.  If the
     kill buffer contains a sequence of lines (as opposed to
     characters), paste it above the current line.

vi-put-after (unbound) (p) (unbound)
     Insert the contents of the kill buffer after the cursor.  If the
     kill buffer contains a sequence of lines (as opposed to
     characters), paste it below the current line.

quoted-insert (^V) (unbound) (unbound)
     Insert the next character typed into the buffer literally.  An
     interrupt character will not be inserted.

vi-quoted-insert (unbound) (unbound) (^Q ^V)
     Display a `^' at the cursor position, and insert the next
     character typed into the buffer literally.  An interrupt character
     will not be inserted.

quote-line (ESC-') (unbound) (unbound)
     Quote the current line; that is, put a `'' character at the
     beginning and the end, and convert all `'' characters to `'\'''.

quote-region (ESC-") (unbound) (unbound)
     Quote the region from the cursor to the mark.

vi-replace (unbound) (R) (unbound)
     Enter overwrite mode.

vi-repeat-change (unbound) (.) (unbound)
     Repeat the last vi mode text modification.  If a count was used
     with the modification, it is remembered.  If a count is given to
     this command, it overrides the remembered count, and is remembered
     for future uses of this command.  The cut buffer specification is
     similarly remembered.

vi-replace-chars (unbound) (r) (unbound)
     Replace the character under the cursor with a character read from
     the keyboard.

self-insert (printable characters) (unbound) (printable characters and some control characters)
     Insert a character into the buffer at the cursor position.

self-insert-unmeta (ESC-^I ESC-^J ESC-^M) (unbound) (unbound)
     Insert a character into the buffer after stripping the meta bit
     and converting ^M to ^J.

vi-substitute (unbound) (s) (unbound)
     Substitute the next character(s).

vi-swap-case (unbound) (~) (unbound)
     Swap the case of the character under the cursor and move past it.

transpose-chars (^T) (unbound) (unbound)
     Exchange the two characters to the left of the cursor if at end of
     line, else exchange the character under the cursor with the
     character to the left.

transpose-words (ESC-T ESC-t) (unbound) (unbound)
     Exchange the current word with the one before it.

vi-unindent (unbound) (<) (unbound)
     Unindent a number of lines.

up-case-word (ESC-U ESC-u) (unbound) (unbound)
     Convert the current word to all caps and move past it.

yank (^Y) (unbound) (unbound)
     Insert the contents of the kill buffer at the cursor position.

yank-pop (ESC-y) (unbound) (unbound)
     Remove the text just yanked, rotate the kill-ring, and yank the
     new top.  Only works following yank or yank-pop.

vi-yank (unbound) (y) (unbound)
     Read a movement command from the keyboard, and copy the region
     from the cursor position to the endpoint of the movement into the
     kill buffer.  If the command is vi-yank, copy the current line.

vi-yank-whole-line (unbound) (Y) (unbound)
     Copy the current line into the kill buffer.

vi-yank-eol
     Copy the region from the cursor position to the end of the line
     into the kill buffer.  Arguably, this is what Y should do in vi,
     but it isn't what it actually does.


File: zsh.info,  Node: Arguments,  Next: Completion,  Prev: Modifying Text,  Up: Zle Widgets

Arguments
---------

digit-argument (ESC-0..ESC-9) (1-9) (unbound)
     Start a new numeric argument, or add to the current one.  See also
     vi-digit-or-beginning-of-line.  This only works if bound to a key
     sequence ending in a decimal digit.

     Inside a widget function, a call to this function treats the last
     key of the key sequence which called the widget as the digit.

neg-argument (ESC--) (unbound) (unbound)
     Changes the sign of the following argument.

universal-argument
     Multiply the argument of the next command by 4.  Alternatively, if
     this command is followed by an integer (positive or negative), use
     that as the argument for the next command.  Thus digits cannot be
     repeated using this command.  For example, if this command occurs
     twice, followed immediately by forward-char, move forward sixteen
     spaces; if instead it is followed by -2, then forward-char, move
     backward two spaces.

     Inside a widget function, if passed an argument, i.e. `zle
     universal-argument NUM', the numerical argument will be set to
     NUM; this is equivalent to `NUMERIC=NUM'.


File: zsh.info,  Node: Completion,  Next: Miscellaneous,  Prev: Arguments,  Up: Zle Widgets

Completion
----------

accept-and-menu-complete
     In a menu completion, insert the current completion into the
     buffer, and advance to the next possible completion.

complete-word
     Attempt completion on the current word.

delete-char-or-list (^D) (unbound) (unbound)
     Delete the character under the cursor.  If the cursor is at the
     end of the line, list possible completions for the current word.

expand-cmd-path
     Expand the current command to its full pathname.

expand-or-complete (TAB) (unbound) (TAB)
     Attempt shell expansion on the current word.  If that fails,
     attempt completion.

expand-or-complete-prefix
     Attempt shell expansion on the current word up to cursor.

expand-history (ESC-space ESC-!) (unbound) (unbound)
     Perform history expansion on the edit buffer.

expand-word (^X*) (unbound) (unbound)
     Attempt shell expansion on the current word.

list-choices (ESC-^D) (^D =) (^D)
     List possible completions for the current word.

list-expand (^Xg ^XG) (^G) (^G)
     List the expansion of the current word.

magic-space
     Perform history expansion and insert a space into the buffer.
     This is intended to be bound to space.

menu-complete
     Like complete-word, except that menu completion is used.  See the
     MENU_COMPLETE option.

menu-expand-or-complete
     Like expand-or-complete, except that menu completion is used.

reverse-menu-complete
     Perform menu completion, like menu-complete, except that if a menu
     completion is already in progress, move to the _previous_
     completion rather than the next.

end-of-list
     When a previous completion displayed a list below the prompt, this
     widget can be used to move the prompt below the list.


File: zsh.info,  Node: Miscellaneous,  Prev: Completion,  Up: Zle Widgets

Miscellaneous
-------------

accept-and-hold (ESC-A ESC-a) (unbound) (unbound)
     Push the contents of the buffer on the buffer stack and execute it.

accept-and-infer-next-history
     Execute the contents of the buffer.  Then search the history list
     for a line matching the current one and push the event following
     onto the buffer stack.

accept-line (^J ^M) (^J ^M) (^J ^M)
     Finish editing the buffer.  Normally this causes the buffer to be
     executed as a shell command.

accept-line-and-down-history (^O) (unbound) (unbound)
     Execute the current line, and push the next history event on the
     the buffer stack.

beep
     Beep, unless the BEEP option is unset.

vi-cmd-mode (^X^V) (unbound) (^[)
     Enter command mode; that is, select the `vicmd' keymap.  Yes, this
     is bound by default in emacs mode.

vi-caps-lock-panic
     Hang until any lowercase key is pressed.  This is for vi users
     without the mental capacity to keep track of their caps lock key
     (like the author).

clear-screen (^L ESC-^L) (^L) (^L)
     Clear the screen and redraw the prompt.

describe-key-briefly
     Reads a key sequence, then prints the function bound to that
     sequence.

exchange-point-and-mark (^X^X) (unbound) (unbound)
     Exchange the cursor position with the position of the mark.

execute-named-cmd (ESC-x) (unbound) (unbound)
     Read the name of an editor command and execute it.  A restricted
     set of editing functions is available in the mini-buffer.  An
     interrupt signal, as defined by the stty setting, will abort the
     function. The allowed functions are: backward-delete-char,
     vi-backward-delete-char, clear-screen, redisplay, quoted-insert,
     vi-quoted-insert, backward-kill-word, vi-backward-kill-word,
     kill-whole-line, vi-kill-line, backward-kill-line, list-choices,
     delete-char-or-list, complete-word, accept-line,
     expand-or-complete and expand-or-complete-prefix.

     kill-region kills the last word, and vi-cmd-mode is treated the
     same as accept-line.  The space and tab characters, if not bound
     to one of these functions, will complete the name and then list the
     possibilities if the AUTO_LIST option is set.  Any other character
     that is not bound to self-insert or self-insert-unmeta will beep
     and be ignored.  The bindings of the current insert mode will be
     used.

execute-last-named-cmd (ESC-z) (unbound) (unbound)
     Redo the last function executed with execute-named-cmd.

get-line (ESC-G ESC-g) (unbound) (unbound)
     Pop the top line off the buffer stack and insert it at the cursor
     position.

pound-insert (unbound) (#) (unbound)
     If there is no # character at the beginning of the buffer, add one
     to the beginning of each line.  If there is one, remove a # from
     each line that has one.  In either case, accept the current line.
     The INTERACTIVE_COMMENTS option must be set for this to have any
     usefulness.

vi-pound-insert
     If there is no # character at the beginning of the current line,
     add one.  If there is one, remove it.  The INTERACTIVE_COMMENTS
     option must be set for this to have any usefulness.

push-input
     Push the entire current multiline construct onto the buffer stack
     and return to the top-level (PS1) prompt.  If the current parser
     construct is only a single line, this is exactly like push-line.
     Next time the editor starts up or is popped with get-line, the
     construct will be popped off the top of the buffer stack and loaded
     into the editing buffer.

push-line (^Q ESC-Q ESC-q) (unbound) (unbound)
     Push the current buffer onto the buffer stack and clear the buffer.
     Next time the editor starts up, the buffer will be popped off the
     top of the buffer stack and loaded into the editing buffer.

push-line-or-edit
     At the top-level (PS1) prompt, equivalent to push-line.  At a
     secondary (PS2) prompt, move the entire current multiline
     construct into the editor buffer.  The latter is equivalent to
     push-input followed by get-line.

recursive-edit
     Only useful from a user-defined widget.  At this point in the
     function, the editor regains control until one of the standard
     widgets which would normally cause zle to exit (typically an
     accept-line caused by hitting the return key) is executed.
     Instead, control returns to the user-defined widget.  The status
     returned is non-zero if the return was caused by an error, but the
     function still continues executing and hence may tidy up.  This
     makes it safe for the user-defined widget to alter the command
     line or key bindings temporarily.

     The following widget, caps-lock, serves as an example.
          self-insert-ucase() {
            LBUFFER+=${(U)KEYS[-1]}
          }
          
          
          integer stat
          
          
          zle -N self-insert self-insert-ucase
          zle -A caps-lock save-caps-lock
          zle -A accept-line caps-lock
          
          
          zle recursive-edit
          stat=$?
          
          
          zle -A .self-insert self-insert
          zle -A save-caps-lock caps-lock
          zle -D save-caps-lock
          
          
          (( stat )) && zle send-break
          
          
          return $stat
     This causes typed letters to be inserted capitalised until either
     accept-line (i.e. typically the return key) is typed or the
     caps-lock widget is invoked again; the later is handled by saving
     the old definition of caps-lock as save-caps-lock and then
     rebinding it to invoke accept-line.  Note that an error from the
     recursive edit is detected as a non-zero return status and
     propagated by using the send-break widget.

redisplay (unbound) (^R) (^R)
     Redisplays the edit buffer.

reset-prompt (unbound) (unbound) (unbound)
     Force the prompts on both the left and right of the screen to be
     re-expanded, then redisplay the edit buffer.  This reflects
     changes both to the prompt variables themselves and changes in the
     expansion of the values (for example, changes in time or
     directory, or changes to the value of variables referred to by the
     prompt).

     Otherwise, the prompt is only expanded each time zle starts, and
     when the display as been interrupted by output from another part
     of the shell (such as a job notification) which causes the command
     line to be reprinted.

send-break (^G ESC-^G) (unbound) (unbound)
     Abort the current editor function, e.g. execute-named-command, or
     the editor itself, e.g. if you are in vared. Otherwise abort the
     parsing of the current line.

run-help (ESC-H ESC-h) (unbound) (unbound)
     Push the buffer onto the buffer stack, and execute the command
     `run-help CMD', where CMD is the current command.  run-help is
     normally aliased to man.

vi-set-buffer (unbound) (") (unbound)
     Specify a buffer to be used in the following command.  There are
     35 buffers that can be specified: the 26 `named' buffers "a to "z
     and the nine `queued' buffers "1 to "9.  The named buffers can also
     be specified as "A to "Z.

     When a buffer is specified for a cut command, the text being cut
     replaces the previous contents of the specified buffer.  If a
     named buffer is specified using a capital, the newly cut text is
     appended to the buffer instead of overwriting it.

     If no buffer is specified for a cut command, "1 is used, and the
     contents of "1 to "8 are each shifted along one buffer; the
     contents of "9 is lost.

vi-set-mark (unbound) (m) (unbound)
     Set the specified mark at the cursor position.

set-mark-command (^@) (unbound) (unbound)
     Set the mark at the cursor position.

spell-word (ESC-$ ESC-S ESC-s) (unbound) (unbound)
     Attempt spelling correction on the current word.

undefined-key
     This command is executed when a key sequence that is not bound to
     any command is typed.  By default it beeps.

undo (^_ ^Xu ^X^U) (unbound) (unbound)
     Incrementally undo the last text modification.

redo
     Incrementally redo undone text modifications.

vi-undo-change (unbound) (u) (unbound)
     Undo the last text modification.  If repeated, redo the
     modification.

what-cursor-position (^X=) (unbound) (unbound)
     Print the character under the cursor, its code as an octal,
     decimal and hexadecimal number, the current cursor position within
     the buffer and the column of the cursor in the current line.

where-is
     Read the name of an editor command and and print the listing of key
     sequences that invoke the specified command.

which-command (ESC-?) (unbound) (unbound)
     Push the buffer onto the buffer stack, and execute the command
     `which-command CMD'. where CMD is the current command.
     which-command is normally aliased to WHENCE.

vi-digit-or-beginning-of-line (unbound) (0) (unbound)
     If the last command executed was a digit as part of an argument,
     continue the argument.  Otherwise, execute vi-beginning-of-line.


File: zsh.info,  Node: Completion Widgets,  Next: Completion System,  Prev: Zsh Line Editor,  Up: Top

Completion Widgets
******************

Description
===========

The shell's programmable completion mechanism can be manipulated in two
ways; here the low-level features supporting the newer, function-based
mechanism are defined.  A complete set of shell functions based on these
features is described in the next chapter, *Note Completion System::,
and users with no interest in adding to that system (or, potentially,
writing their own -- see dictionary entry for `hubris') should skip this
section.  The older system based on the compctl builtin command is
described in *Note Completion Using compctl::.

Completion widgets are defined by the -C option to the zle builtin
command provided by the zsh/zle module (see *Note The zsh/zle
Module::). For example,

     zle -C complete expand-or-complete completer

defines a widget named `complete'.  The second argument is the name of
any of the builtin widgets that handle completions: complete-word,
expand-or-complete, expand-or-complete-prefix, menu-complete,
menu-expand-or-complete, reverse-menu-complete, list-choices, or
delete-char-or-list.  Note that this will still work even if the widget
in question has been re-bound.

When this newly defined widget is bound to a key using the bindkey
builtin command defined in the zsh/zle module (*Note Zsh Line
Editor::), typing that key will call the shell function `completer'.
This function is responsible for generating the possible matches using
the builtins described below.  As with other ZLE widgets, the function
is called with its standard input closed.

Once the function returns, the completion code takes over control again
and treats the matches in the same manner as the specified builtin
widget, in this case expand-or-complete.

* Menu:

* Special Parameters::
* Builtin Commands::
* Condition Codes::
* Matching Control::
* Completion Widget Example::


File: zsh.info,  Node: Special Parameters,  Next: Builtin Commands,  Up: Completion Widgets

Special Parameters
==================

Inside completion widgets, and any functions called from them, some
parameters have special meaning; outside these functions they are not
special to the shell in any way.  These parameters are used to pass
information between the completion code and the completion widget. Some
of the builtin commands and the condition codes use or change the
current values of these parameters.  Any existing values will be hidden
during execution of completion widgets; except for compstate, the
parameters are reset on each function exit (including nested function
calls from within the completion widget) to the values they had when
the function was entered.

CURRENT
     This is the number of the current word, i.e. the word the cursor is
     currently on in the words array.  Note that this value is only
     correct if the ksharrays option is not set.

IPREFIX
     Initially this will be set to the empty string.  This parameter
     functions like PREFIX; it contains a string which precedes the one
     in PREFIX and is not considered part of the list of matches.
     Typically, a string is transferred from the beginning of PREFIX to
     the end of IPREFIX, for example:

          IPREFIX=${PREFIX%%\=*}=
          PREFIX=${PREFIX#*=}

     causes the part of the prefix up to and including the first equal
     sign not to be treated as part of a matched string.  This can be
     done automatically by the compset builtin, see below.

ISUFFIX
     As IPREFIX, but for a suffix that should not be considered part of
     the matches; note that the ISUFFIX string follows the SUFFIX
     string.

PREFIX
     Initially this will be set to the part of the current word from the
     beginning of the word up to the position of the cursor; it may be
     altered to give a common prefix for all matches.

QIPREFIX
     This parameter is read-only and contains the quoted string up to
     the word being completed. E.g. when completing `"foo', this
     parameter contains the double quote. If the -q option of compset
     is used (see below), and the original string was `"foo bar' with
     the cursor on the `bar', this parameter contains `"foo '.

QISUFFIX
     Like QIPREFIX, but containing the suffix.

SUFFIX
     Initially this will be set to the part of the current word from the
     cursor position to the end; it may be altered to give a common
     suffix for all matches.  It is most useful when the option
     COMPLETE_IN_WORD is set, as otherwise the whole word on the
     command line is treated as a prefix.

compstate
     This is an associative array with various keys and values that the
     completion code uses to exchange information with the completion
     widget.  The keys are:

    all_quotes
          The -q option of the compset builtin command (see below)
          allows a quoted string to be broken into separate words; if
          the cursor is on one of those words, that word will be
          completed, possibly invoking `compset -q' recursively.  With
          this key it is possible to test the types of quoted strings
          which are currently broken into parts in this fashion.  Its
          value contains one character for each quoting level.  The
          characters are a single quote or a double quote for strings
          quoted with these characters and a backslash for strings not
          starting with a quote character.  The first character in the
          value always corresponds to the innermost quoting level.

    context
          This will be set by the completion code to the overall context
          in which completion is attempted. Possible values are:

         array_value
               when completing inside the value of an array parameter
               assignment; in this case the words array contains the
               words inside the parentheses.

         brace_parameter
               when completing the name of a parameter in a parameter
               expansion beginning with ${.

         assign_parameter
               when completing the name of a parameter in a parameter
               assignment.

         command
               when completing for a normal command (either in command
               position or for an argument of the command).

         condition
               when completing inside a `[[...]]' conditional
               expression; in this case the words array contains only
               the words inside the conditional expression.

         math
               when completing in a mathematical environment such as a
               `((...))' construct.

         parameter
               when completing the name of a parameter in a parameter
               expansion beginning with $ but not ${.

         redirect
               when completing after a redirection operator.

         subscript
               when completing inside a parameter subscript.

         value
               when completing the value of a parameter assignment.

    exact
          Controls the behaviour when the REC_EXACT option is set.  It
          will be set to accept if an exact match would be accepted,
          and will be unset otherwise.

          If it was set when at least one match equal to the string on
          the line was generated, the match is accepted.

    exact_string
          The string of an exact match if one was found, otherwise
          unset.

    ignored
          The number of words that were ignored because they matched
          one of the patterns given with the -F option to the compadd
          builtin command.

    insert
          This controls the manner in which a match is inserted into
          the command line.  On entry to the widget function, if it is
          unset the command line is not to be changed; if set to
          unambiguous, any prefix common to all matches is to be
          inserted; if set to automenu-unambiguous, the common prefix
          is to be inserted and the next invocation of the completion
          code may start menu completion (due to the AUTO_MENU option
          being set); if set to menu or automenu menu completion will
          be started for the matches currently generated (in the latter
          case this will happen because the AUTO_MENU is set). The
          value may also contain the string `tab' when the completion
          code would normally not really do completion, but only insert
          the TAB character.

          On exit it may be set to any of the values above (where
          setting it to the empty string is the same as unsetting it),
          or to a number, in which case the match whose number is given
          will be inserted into the command line.  Negative numbers
          count backward from the last match (with `-1' selecting the
          last match) and out-of-range values are wrapped around, so
          that a value of zero selects the last match and a value one
          more than the maximum selects the first. Unless the value of
          this key ends in a space, the match is inserted as in a menu
          completion, i.e. without automatically appending a space.

          Both menu and automenu may also specify the the number of the
          match to insert, given after a colon.  For example, `menu:2'
          says to start menu completion, beginning with the second
          match.

          Note that a value containing the substring `tab' makes the
          matches generated be ignored and only the TAB be inserted.

          Finally, it may also be set to all, which makes all matches
          generated be inserted into the line.

    insert_positions
          When the completion system inserts an unambiguous string into
          the line, there may be multiple places where characters are
          missing or where the character inserted differs from at least
          one match.  The value of this key contains a colon separated
          list of all these positions, as indexes into the command line.

    last_prompt
          If this is set to a non-empty string for every match added,
          the completion code will move the cursor back to the previous
          prompt after the list of completions has been displayed.
          Initially this is set or unset according to the
          ALWAYS_LAST_PROMPT option.

    list
          This controls whether or how the list of matches will be
          displayed.  If it is unset or empty they will never be
          listed; if its value begins with list, they will always be
          listed; if it begins with autolist or ambiguous, they will be
          listed when the AUTO_LIST or LIST_AMBIGUOUS options
          respectively would normally cause them to be.

          If the substring force appears in the value, this makes the
          list be shown even if there is only one match. Normally, the
          list would be shown only if there are at least two matches.

          The value contains the substring packed if the LIST_PACKED
          option is set. If this substring is given for all matches
          added to a group, this group will show the LIST_PACKED
          behavior. The same is done for the LIST_ROWS_FIRST option
          with the substring rows.

          Finally, if the value contains the string explanations, only
          the explanation strings, if any, will be listed and if it
          contains messages, only the messages (added with the -x
          option of compadd) will be listed.  If it contains both
          explanations and messages both kinds of explanation strings
          will be listed.  It will be set appropriately on entry to a
          completion widget and may be changed there.

    list_lines
          This gives the number of lines that are needed to display the
          full list of completions.  Note that to calculate the total
          number of lines to display you need to add the number of
          lines needed for the command line to this value, this is
          available as the value of the BUFFERLINES special parameter.

    list_max
          Initially this is set to the value of the LISTMAX parameter.
          It may be set to any other value; when the widget exits this
          value will be used in the same way as the value of LISTMAX.

    nmatches
          The number of matches generated and accepted by the
          completion code so far.

    old_insert
          On entry to the widget this will be set to the number of the
          match of an old list of completions that is currently
          inserted into the command line. If no match has been
          inserted, this is unset.

          As with old_list, the value of this key will only be used if
          it is the string keep. If it was set to this value by the
          widget and there was an old match inserted into the command
          line, this match will be kept and if the value of the insert
          key specifies that another match should be inserted, this
          will be inserted after the old one.

    old_list
          This is set to yes if there is still a valid list of
          completions from a previous completion at the time the widget
          is invoked.  This will usually be the case if and only if the
          previous editing operation was a completion widget or one of
          the builtin completion functions.  If there is a valid list
          and it is also currently shown on the screen, the value of
          this key is shown.

          After the widget has exited the value of this key is only
          used if it was set to keep.  In this case the completion code
          will continue to use this old list.  If the widget generated
          new matches, they will not be used.

    parameter
          The name of the parameter when completing in a subscript or
          in the value of a parameter assignment.

    pattern_insert
          Normally this is set to menu, which specifies that menu
          completion will be used whenever a set of matches was
          generated using pattern matching.  If it is set to any other
          non-empty string by the user and menu completion is not
          selected by other option settings, the code will instead
          insert any common prefix for the generated matches as with
          normal completion.

    pattern_match
          Locally controls the behaviour given by the GLOB_COMPLETE
          option.  Initially it is set to `*' if and only if the option
          is set.  The completion widget may set it to this value, to
          an empty string (which has the same effect as unsetting it),
          or to any other non-empty string.  If it is non-empty,
          unquoted metacharacters on the command line will be treated
          as patterns; if it is `*', then additionally a wildcard `*'
          is assumed at the cursor position; if it is empty or unset,
          metacharacters will be treated literally.

          Note that the matcher specifications given to the compadd
          builtin command are not used if this is set to a non-empty
          string.

    quote
          When completing inside quotes, this contains the quotation
          character (i.e. either a single quote, a double quote, or a
          backtick).  Otherwise it is unset.

    quoting
          When completing inside single quotes, this is set to the
          string single; inside double quotes, the string double;
          inside backticks, the string backtick.  Otherwise it is unset.

    redirect
          The redirection operator when completing in a redirection
          position, i.e. one of <, >, etc.

    restore
          This is set to auto before a function is entered, which
          forces the special parameters mentioned above (words,
          CURRENT, PREFIX, IPREFIX, SUFFIX, and ISUFFIX) to be restored
          to their previous values when the function exits.   If a
          function unsets it or sets it to any other string, they will
          not be restored.

    to_end
          Specifies the occasions on which the cursor is moved to the
          end of a string when a match is inserted.  On entry to a
          widget function, it may be single if this will happen when a
          single unambiguous match was inserted or match if it will
          happen any time a match is inserted (for example, by menu
          completion; this is likely to be the effect of the
          ALWAYS_TO_END option).

          On exit, it may be set to single as above.  It may also be
          set to always, or to the empty string or unset; in those
          cases the cursor will be moved to the end of the string
          always or never respectively.  Any other string is treated as
          match.

    unambiguous
          This key is read-only and will always be set to the common
          (unambiguous) prefix the completion code has generated for
          all matches added so far.

    unambiguous_cursor
          This gives the position the cursor would be placed at if the
          common prefix in the unambiguous key were inserted, relative
          to the value of that key. The cursor would be placed before
          the character whose index is given by this key.

    unambiguous_positions
          This contains all positions where characters in the
          unambiguous string are missing or where the character
          inserted differs from at least one of the matches.  The
          positions are given as indexes into the string given by the
          value of the unambiguous key.

    vared
          If completion is called while editing a line using the vared
          builtin, the value of this key is set to the name of the
          parameter given as an argument to vared.  This key is only
          set while a vared command is active.

words
     This array contains the words present on the command line
     currently being edited.

