Flags with Arguments
--------------------
These have user supplied arguments to determine how the list of
completions is to be made up:
-k ARRAY
Names taken from the elements of $ARRAY (note that the `$' does
not appear on the command line). Alternatively, the argument
ARRAY itself may be a set of space- or comma-separated values in
parentheses, in which any delimiter may be escaped with a
backslash; in this case the argument should be quoted. For
example,
compctl -k "(cputime filesize datasize stacksize
coredumpsize resident descriptors)" limit
-g GLOBSTRING
The GLOBSTRING is expanded using filename globbing; it should be
quoted to protect it from immediate expansion. The resulting
filenames are taken as the possible completions. Use `*(/)'
instead of `*/' for directories. The fignore special parameter is
not applied to the resulting files. More than one pattern may be
given separated by blanks. (Note that brace expansion is _not_
part of globbing. Use the syntax `(either|or)' to match
alternatives.)
-s SUBSTSTRING
The SUBSTSTRING is split into words and these words are than
expanded using all shell expansion mechanisms (see Note:Expansion). The resulting words are taken as possible
completions. The fignore special parameter is not applied to the
resulting files. Note that -g is faster for filenames.
-K FUNCTION
Call the given function to get the completions. Unless the name
starts with an underscore, the function is passed two arguments:
the prefix and the suffix of the word on which completion is to be
attempted, in other words those characters before the cursor
position, and those from the cursor position onwards. The whole
command line can be accessed with the -c and -l flags of the read
builtin. The function should set the variable reply to an array
containing the completions (one completion per element); note that
reply should not be made local to the function. From such a
function the command line can be accessed with the -c and -l flags
to the read builtin. For example,
function whoson { reply=(`users`); }
compctl -K whoson talk
completes only logged-on users after `talk'. Note that `whoson'
must return an array, so `reply=`users`' would be incorrect.
-H NUM PATTERN
The possible completions are taken from the last NUM history
lines. Only words matching PATTERN are taken. If NUM is zero or
negative the whole history is searched and if PATTERN is the empty
string all words are taken (as with `*'). A typical use is
compctl -D -f + -H 0 ''
which forces completion to look back in the history list for a
word if no filename matches.