GNU Info

Info Node: (zsh.info)Completion Widgets

(zsh.info)Completion Widgets


Next: Completion System Prev: Zsh Line Editor Up: Top
Enter node , (file) or (file)node

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 the chapter 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.

Special Parameters
Builtin Commands
Condition Codes
Matching Control
Completion Widget Example

automatically generated by info2www version 1.2.2.9