Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
CARE

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 229 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

zshcompctl



SYNOPSIS

       This  version of zsh has two ways of performing completion
       of words on the command line.  New users of the shell  may
       prefer  to use the newer and more powerful system based on
       shell functions; this is described in  zshcompsys(1),  and
       the  basic shell mechanisms which support it are described
       in zshcompwid(1).  This manual entry describes  the  older
       compctl command.


DESCRIPTION

       compctl [ -CDT ] options [ command ... ]
       compctl [ -CDT ] options [ -x pattern options - ... -- ] [
       + options [ -x ... -- ] ... [+] ] [ command ... ]
       compctl -M match-specs ...
       compctl -L [ -CDTM ] [ command ... ]
       compctl + command ...

       Control  the editor's completion behavior according to the
       supplied  set  of  options.   Various  editing   commands,
       notably  expand-or-complete-word,  usually  bound  to tab,
       will attempt to complete a word typed by the  user,  while
       others,  notably  delete-char-or-list, usually bound to ^D
       in EMACS editing mode,  list  the  possibilities;  compctl
       controls what those possibilities are.  They may for exam­
       ple be filenames (the most  common  case,  and  hence  the
       default),  shell variables, or words from a user-specified
       list.


COMMAND FLAGS

       Completion of the arguments of a command may be  different
       for  each  command  or  may use the default.  The behavior
       when completing the command word itself may also be  sepa­
       rately specified.  These correspond to the following flags
       and arguments, all of which (except for -L)  may  be  com­
       bined with any combination of the options described subse­
       quently in the section `Option Flags':

       command ...
              controls completion for the named  commands,  which
              must  be  listed last on the command line.  If com­
              pletion is attempted for a command with a  pathname
              containing  slashes and no completion definition is
              found, the search is retried with the last pathname
              component.  If the command starts with a =, comple­
              tion is tried with the pathname of the command.

              Any of the command strings may be patterns  of  the
              form  normally used for filename generation.  These
              should be be quoted to protect them from  immediate
              expansion;  for  example  the command string 'foo*'
              arranges for completion of the words of any command

       -C     controls completion when the command word itself is
              being completed.  If no compctl -C command has been
              issued,    the  names  of  any  executable  command
              (whether in the path or specific to the shell, such
              as aliases or functions) are completed.

       -D     controls  default completion behavior for the argu­
              ments of commands not assigned any  special  behav­
              ior.   If  no  compctl  -D command has been issued,
              filenames are completed.

       -T     supplies completion flags to  be  used  before  any
              other  processing  is  done, even before processing
              for compctls defined for specific  commands.   This
              is  especially  useful  when combined with extended
              completion (the -x flag, see the section  `Extended
              Completion' below).  Using this flag you can define
              default behavior which will apply to  all  commands
              without  exception,  or  you can alter the standard
              behavior for all commands.  For  example,  if  your
              access  to  the user database is too slow and/or it
              contains too many users (so that  completion  after
              `~' is too slow to be usable), you can use

                     compctl -T -x 's[~] C[0,[^/]#]' -k friends -S/ -tn

              to  complete the strings in the array friends after
              a `~'.  The C[...] argument is  necessary  so  that
              this  form  of  ~-completion is not tried after the
              directory name is finished.

       -L     lists the existing completion behavior in a  manner
              suitable  for  putting  into a start-up script; the
              existing behavior is not changed.  Any  combination
              of the above forms, or the -M flag (which must fol­
              low the -L flag), may be specified,  otherwise  all
              defined  completions  are  listed.  Any other flags
              supplied are ignored.

       no argument
              If no argument is given, compctl lists all  defined
              completions in an abbreviated form;  with a list of
              options, all completions with those flags set  (not
              counting extended completion) are listed.

       If  the  +  flag  is alone and followed immediately by the
       command list, the completion behavior for all the commands
       in the list is reset to the default.  In other words, com­
       pletion will subsequently use the options specified by the
       -D flag.

       The  form  with  -M  as  the first and only option defines
       [ -fcFBdeaRGovNAIOPZEnbjrzu/12 ]
       [ -k array ] [ -g globstring ] [ -s subststring ]
       [ -K function ]
       [ -Q ] [ -P prefix ] [ -S suffix ]
       [ -W file-prefix ] [ -H num pattern ]
       [ -q ] [ -X explanation ] [ -Y explanation ]
       [ -y func-or-var ] [ -l cmd ] [ -h cmd ] [ -U ]
       [ -t continue ] [ -J name ] [ -V name ]
       [ -M match-spec ]

       The remaining options specify the type  of  command  argu­
       ments  to  look for during completion.  Any combination of
       these flags may be specified; the result is a sorted  list
       of all the possibilities.  The options are as follows.

   Simple Flags
       These  produce  completion  lists  made  up  by  the shell
       itself:

       -f     Filenames and filesystem paths.

       -/     Just filesystem paths.

       -c     Command names, including aliases, shell  functions,
              builtins and reserved words.

       -F     Function names.

       -B     Names of builtin commands.

       -m     Names of external commands.

       -w     Reserved words.

       -a     Alias names.

       -R     Names of regular (non-global) aliases.

       -G     Names of global aliases.

       -d     This can be combined with -F, -B, -w, -a, -R and -G
              to  get  names  of  disabled  functions,  builtins,
              reserved words or aliases.

       -e     This option (to show enabled commands) is in effect
              by default, but may be combined  with  -d;  -de  in
              combination  with  -F,  -B,  -w, -a, -R and -G will
              complete names  of  functions,  builtins,  reserved
              words  or aliases whether or not they are disabled.

       -o     Names of shell options (see zshoptions(1)).
       -Z     Names of shell special parameters.

       -E     Names of environment variables.

       -n     Named directories.

       -b     Key binding names.

       -j     Job names:  the first word of the job leader's com­
              mand line.  This is useful with the kill builtin.

       -r     Names of running jobs.

       -z     Names of suspended jobs.

       -u     User names.

   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  paren­
              theses,  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  mecha­
              nisms  (see  zshexpn(1)).   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.
              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 his­
              tory 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.

   Control Flags
       These  do  not  directly  specify types of name to be com­
       pleted, but manipulate the options that do:

       -Q     This instructs the shell not to quote any metachar­
              acters  in  the possible completions.  Normally the
              results of a completion are inserted into the  com­
              mand  line  with  any metacharacters quoted so that
              they are interpreted as normal characters.  This is
              appropriate  for  filenames  and  ordinary strings.
              However, for special effects, such as  inserting  a
              backquoted  expression from a completion array (-k)
              so that the expression will not be evaluated  until
              the  complete line is executed, this option must be
              used.

       -P prefix
              The prefix is inserted just  before  the  completed
              string; any initial part already typed will be com­
              pleted and the whole prefix ignored for  completion
              purposes.  For example,

                     compctl -j -P "%" kill

              inserts  a `%' after the kill command and then com­
              pletes job names.

       -S suffix
              completes  any  subdirectories to any depth beneath
              the directory ~/Mail, although that prefix does not
              appear  on  the  command line.  The file-prefix may
              also be of the form accepted by the -k  flag,  i.e.
              the name of an array or a literal list in parenthe­
              sis. In this case all the directories in  the  list
              will be searched for possible completions.

       -q     If  used  with  a  suffix  as  specified  by the -S
              option, this causes the suffix to be removed if the
              next  character typed is a blank or does not insert
              anything or if the  suffix  consists  of  only  one
              character  and the next character typed is the same
              character;  this  the  same  rule  used   for   the
              AUTO_REMOVE_SLASH  option.  The option is most use­
              ful for list separators (comma, colon, etc.).

       -l cmd This option restricts the  range  of  command  line
              words that are considered to be arguments.  If com­
              bined with one of the extended completion  patterns
              `p[...]',  `r[...]',  or `R[...]'  (see the section
              `Extended   Completion'   below)   the   range   is
              restricted  to  the range of arguments specified in
              the brackets.  Completion is then performed  as  if
              these  had  been given as arguments to the cmd sup­
              plied with the option. If the cmd string  is  empty
              the first word in the range is instead taken as the
              command name, and command name completion performed
              on the first word in the range.  For example,

                     compctl -x 'r[-exec,;]' -l '' -- find

              completes arguments between `-exec' and the follow­
              ing `;' (or the end of the command line if there is
              no  such string) as if they were a separate command
              line.

       -h cmd Normally zsh completes quoted strings as  a  whole.
              With this option, completion can be done separately
              on different parts of such strings. It  works  like
              the -l option but makes the completion code work on
              the parts of the current word that are separated by
              spaces.  These  parts are completed as if they were
              arguments to the given cmd. If  cmd  is  the  empty
              string,  the  first  part is completed as a command
              name, as with -l.

       -U     Use the whole list of possible completions, whether
              or  not they actually match the word on the command
              line.  The word typed so far will be deleted.  This
              is  most  useful  with  a function (given by the -K
              option)  which  can  examine  the  word  components
              it defines a variable, or if it begins with a  left
              parenthesis  a  literal  array,  which contains the
              list.  A variable may have been set by a call to  a
              function  using  the  -K option.  Otherwise it con­
              tains the name of a function which will be executed
              to create the list.  The function will be passed as
              an argument list all matching completions,  includ­
              ing  prefixes  and  suffixes  expanded in full, and
              should set the array reply to the result.  In  both
              cases,  the  display  list  will  only be retrieved
              after a complete list of matches has been  created.

              Note that the returned list does not have to corre­
              spond, even in  length,  to  the  original  set  of
              matches,  and  may be passed as a scalar instead of
              an array.  No special formatting of  characters  is
              performed  on  the output in this case; in particu­
              lar, newlines are printed  literally  and  if  they
              appear output in columns is suppressed.

       -X explanation
              Print  explanation  when  trying  completion on the
              current set of options. A `%n' in  this  string  is
              replaced  by  the number of matches that were added
              for this explanation string.  The explanation  only
              appears  if  completion  was tried and there was no
              unique match, or when listing completions. Explana­
              tion  strings  will  be  listed  together  with the
              matches of the group specified together with the -X
              option  (using  the  -J  or -V option). If the same
              explanation string is given to multiple -X options,
              the  string  appears only once (for each group) and
              the number of matches shown for  the  `%n'  is  the
              total number of all matches for each of these uses.
              In any case, the explanation string  will  only  be
              shown if there was at least one match added for the
              explanation string.

              The sequences %B, %b, %S, %s, %U,  and  %u  specify
              output  attributes  (bold, standout, and underline)
              and %{...%} can be used to include  literal  escape
              sequences as in prompts.

       -Y explanation
              Identical  to -X, except that the explanation first
              undergoes expansion following the usual  rules  for
              strings  in  double  quotes.  The expansion will be
              carried out after any functions are called for  the
              -K or -y options, allowing them to set variables.

       -t continue
              The continue-string contains a character that spec­

              (iii)  In  an extended completion list (see below),
              when compctl would normally continue until a set of
              conditions succeeded, then use only the immediately
              following flags.  With `-t-', compctl will continue
              trying  extended  completions  after  the next `-';
              with `-tx' it  will  attempt  completion  with  the
              default  flags,  in  other  words  those before the
              `-x'.

       -J name
              This gives the name of the group the matches should
              be  placed  in.  Groups are listed and sorted sepa­
              rately; likewise, menu completion  will  offer  the
              matches  in  the  groups  in the order in which the
              groups were defined. If no group name is explicitly
              given,  the  matches  are  stored  in a group named
              default. The first time a  group  name  is  encoun­
              tered,  a  group  with  that name is created. After
              that all matches  with  the  same  group  name  are
              stored in that group.

              This  can  be useful with non-exclusive alternative
              completions.  For example, in

                     compctl -f -J files -t+ + -v -J variables foo

              both files and variables are possible  completions,
              as  the -t+ forces both sets of alternatives before
              and after the + to be considered at once.   Because
              of  the  -J  options, however, all files are listed
              before all variables.

       -V name
              Like -J, but matches within the group will  not  be
              sorted  in  listings  nor in menu completion. These
              unsorted groups are in a different name space  from
              the  sorted ones, so groups defined as -J files and
              -V files are distinct.

       -1     If given together with the -V  option,  makes  only
              consecutive  duplicates  in  the  group be removed.
              Note that groups with and without this flag are  in
              different name spaces.

       -2     If  given  together with the -J or -V option, makes
              all duplicates be  kept.  Again,  groups  with  and
              without this flag are in different name spaces.

       -M match-spec
              This defines additional matching control specifica­
              tions that should be used only when  testing  words

       point, default completion is tried.  If the list of  flags
       contains  a  -t with a + character, the next list of flags
       is used even if the current list produced matches.


EXTENDED COMPLETION

       compctl [ -CDT ] options -x pattern options - ... --
                [ command ... ]
       compctl [ -CDT ] options [ -x pattern options - ... -- ]
                [ + options [ -x ... -- ] ... [+] ] [ command ... ]

       The form with `-x' specifies extended completion  for  the
       commands given; as shown, it may be combined with alterna­
       tive completion using `+'.  Each pattern  is  examined  in
       turn; when a match is found, the corresponding options, as
       described in the section `Option Flags' above, are used to
       generate possible completions.  If no pattern matches, the
       options given before the -x are used.

       Note that each pattern should  be  supplied  as  a  single
       argument  and  should  be  quoted  to prevent expansion of
       metacharacters by the shell.

       A pattern is built of sub-patterns separated by commas; it
       matches  if  at  least  one  of these sub-patterns matches
       (they are `or'ed). These sub-patterns are in turn composed
       of  other  sub-patterns  separated  by  white spaces which
       match if all of the sub-patterns match (they are `and'ed).
       An   element   of   the   sub-patterns   is  of  the  form
       `c[...][...]', where the pairs of brackets may be repeated
       as  often  as necessary, and matches if any of the sets of
       brackets match (an `or').  The example  below  makes  this
       clearer.

       The elements may be any of the following:

       s[string]...
              Matches  if  the  current  word on the command line
              starts with one of the strings given  in  brackets.
              The  string  is  not removed and is not part of the
              completion.

       S[string]...
              Like s[string] except that the string  is  part  of
              the completion.

       p[from,to]...
              Matches  if  the  number  of  the  current  word is
              between one of the from and to pairs inclusive. The
              comma  and to are optional; to defaults to the same
              value as from.  The numbers  may  be  negative:  -n
              refers to the n'th last word on the line.

       W[index,pattern]...
              Like w but using pattern matching instead.

       n[index,string]...
              Matches  if the current word contains string.  Any­
              thing up to and including the indexth occurrence of
              this string will not be considered part of the com­
              pletion, but the rest will.  index may be  negative
              to count from the end: in most cases, index will be
              1 or -1.  For example,

                     compctl -s '`users`' -x 'n[1,@]' -k hosts -- talk

              will usually complete usernames, but if you  insert
              an  @  after  the  name, names from the array hosts
              (assumed to contain hostnames, though you must make
              the  array yourself) will be completed.  Other com­
              mands such as rcp can be handled similarly.

       N[index,string]...
              Like n except that the string will be  taken  as  a
              character  class.  Anything up to and including the
              indexth occurrence of  any  of  the  characters  in
              string  will  not be considered part of the comple­
              tion.

       m[min,max]...
              Matches if the total number of words  lies  between
              min and max inclusive.

       r[str1,str2]...
              Matches  if  the cursor is after a word with prefix
              str1.  If there is also a word with prefix str2  on
              the  command  line after the one matched by str1 it
              matches only if the cursor is before this word.  If
              the  comma  and str2 are omitted, it matches if the
              cursor is after a word with prefix str1.

       R[str1,str2]...
              Like r but using pattern matching instead.

       q[str]...
              Matches the word currently being  completed  is  in
              single  quotes  and  the str begins with the letter
              `s', or if completion is done in double quotes  and
              str starts with the letter `d', or if completion is
              done in backticks and str starts with a `b'.


EXAMPLE

              compctl -u -x 's[+] c[-1,-f],s[-f+]' \
                -g '~/Mail/*(:t)' - 's[-f],c[-1,-f]' -f -- mail

              complete user names.

zsh 4.1.1                 June 18, 2003             ZSHCOMPCTL(1)
  




Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
You can choose larger fonts by selecting a different themes.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.06 Seconds