diff options
Diffstat (limited to 'Doc/Zsh/compsys.yo')
-rw-r--r-- | Doc/Zsh/compsys.yo | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 9d6cc10ce..f481ee4c0 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -49,7 +49,7 @@ endmenu() texinode(Initialization)(Control Functions)()(Completion System) sect(Initialization) -The function tt(compinstall) can be run by a user to set up the completion +The script tt(compinstall) can be run by a user to set up the completion system for use. It will usually insert code into tt(.zshrc), although if that is not writable it will save it in another file and tell you that file's locations. Note that it is up to you to make sure that the lines @@ -62,10 +62,10 @@ this section by hand is likely to be lost if you rerun tt(compinstall). The new code will take effect next time you start the shell, or run tt(.zshrc) by hand. -To run it, you will need to make sure it is in a directory mentioned in your -tt($fpath) parameter, and that it is autoloaded (`tt(autoload -U -compinstall)' is recommended). It will ask you various questions about how -you would like completion set up. It is in two parts; the basic part +You can run it as `tt(source )var(<path>)tt(/compinstall)' or +`tt(. )var(<path>)tt(/compinstall)', where var(<path>) is where the +completion functions are stored. It will ask you various questions about +how you would like completion set up. It is in two parts; the basic part locates the completion files and decides where to put your personal dumpfile, used to speed up initialization after the first time. After that, you will be asked if you wish to go on to the advanced set-up; if you @@ -86,24 +86,30 @@ This section describes the use of tt(compinit) to initialize completion for the current session when run directly by the user; if you have run tt(compinstall) it will be called automatically from your tt(.zshrc). -To initialize the system, the function tt(compinit) should be in a -directory mentioned in the tt($fpath) variable, and should be autoloaded -(`tt(autoload -U compinit)' is recommended). When run, it will define a -few utility functions, arrange for all the necessary shell functions to be -autoloaded, and will then re-bind all keys that do completion to use the -new system. +To initialize the system, the script tt(compinit) should be sourced with +`tt(source )var(<path>)tt(/compinit)' or +`tt(. )var(<path>)tt(/compinit)'. This will define a few utility functions, +arrange for all the necessary shell functions to be autoloaded, and will +then re-bind all keys that do completion to use the new system. To speed up the running of tt(compinit), it can be made to produce a dumped configuration which will be read in on future invocations. The easiest way -to do this is by adding the option tt(-d) whenever tt(compinit) is run. -In this case the dumped file is tt(.zcompdump) in the same directory as the -startup files (i.e. tt($ZDOTDIR) or tt($HOME)); alternatively, an explicit -file name can be given following the tt(-d). On the next call to -tt(compinit -d), the dumped file will be read instead. - -If the parameter tt(_compdir) is set, tt(compinit) uses it has a directory -where completion functions can be found; this is only necessary if they are -not already in the function search path. +to do this is by adding the option tt(-d) whenever tt(compinit) is sourced. +In this case the dumped file will have the same name as the sourced file, +but with tt(.dump) appended to the end, or, if that is not writable by the +user, the file tt(.zcompdump) in the same directory as the startup files +(i.e. tt($ZDOTDIR) or tt($HOME)); alternatively, an explicit file name can +be given following the tt(-d). On the next call to tt(compinit -d), the +dumped file will be read instead. + +The other option accepted by tt(compinit) is tt(-f )var(dir), which gives +the directory in which tt(compinit) resides. If you source tt(compinit) by +its full pathname, and the option tt(FUNCTION_ARGZERO) is set, as it is by +default unless tt(zsh) is emulating tt(sh) or tt(ksh), this is unnecessary +as tt(compinit) can deduce the directory for itself. It is used in two +ways: to find the program tt(compdump) used by the tt(-d) option, and to +check if the directory should be added to the function search path to find +the completion functions (see below). If the number of completion files changes, tt(compinit) will recognise this and produce a new dump file. However, if the name of a function or the @@ -111,30 +117,27 @@ arguments in the first line of a tt(#compdef) function (as described below) change, it is easiest to delete the dump file by hand so that the next time tt(compinit) will re-create it. -The dumping is actually done by another function, tt(compdump), but you -will only need to run this yourself if you change the configuration +The dumping is actually done by another script, tt(compdump), but you will +only need to source this yourself if you change the configuration (e.g. using tt(compdef)) and then want to dump the new one. The name of -the old dumped file will be remembered for this purpose. +the old dumped file will be remembered for this. subsect(Autoloaded files) The convention for autoloaded functions used in completion is that they start with an underscore; as already mentioned, the tt(fpath/FPATH) -parameter must contain the directory in which they are stored. If tt(zsh) -was properly installed on your system, then tt(fpath/FPATH) automatically -contains the required directories. - -For incomplete installations, if tt(compinit) does not find enough files -beginning with an underscore (fewer than twenty) in the search path, it -will try to find more by adding the directory tt(_compdir) to the search -path; if you have run tt(compinstall), this will be set automatically. +parameter must contain the directory in which they are stored. If +tt(compinit) does not find enough files beginning with an underscore (fewer +than twenty) in the search path, it will try to find more by adding its own +directory to the search path. If you keep all the completion files in this +directory, this means you never have to alter tt(fpath/FPATH) yourself. Furthermore, if the directory in question ends in the path segment tt(Core), or has a subdirectory named tt(Core), tt(compinit) will add all subdirectories of the directory where tt(Core) is to the path: this allows the functions to be in the same format as in the tt(zsh) source distribution. -When tt(compinit) is run, it searches all such files accessible via +When tt(compinit) is sourced, it searches all such files accessible via tt(fpath/FPATH) and reads the first line of each of them. This line should contain one of the tags described below. Files whose first line does not start with one of these tags are not considered to be part of the @@ -162,11 +165,7 @@ var(key-sequences). It creates a widget behaving like the builtin widget var(style), which must be one of those that perform completion, namely tt(complete-word), tt(delete-char-or-list), tt(expand-or-complete), tt(expand-or-complete-prefix), tt(list-choices), tt(menu-complete), -tt(menu-expand-or-complete), or tt(reverse-menu-complete). If the -tt(complist) module is loaded (see -ifzman(zmanref(zshmodules))\ -ifnzman(noderef(The complist Module))\ -), the tt(menu-select) widget can be used, too. +tt(menu-expand-or-complete), or tt(reverse-menu-complete). The widget is then bound to all the var(key-sequences) given, if any: when one of the var(key-sequences) is typed, the function in the file will @@ -475,12 +474,6 @@ configuration key tt(match_original) has a value of `tt(only)', no `tt(*)' will be inserted. If tt(match_original) has any other non-empty string as its value, this completer will first try to generate matches without, then with a `tt(*)' inserted at the cursor position. - -The generated matches will be offered in a menucompletion unless the -tt(match_insert) configuration key is set to a string starting with -`tt(unambig)'. In this case menucompletion will only be started if no -unambiguous string could be generated that is at least as long as the -original string. ) item(tt(_expand))( This completer function does not really do completion, but instead @@ -714,13 +707,10 @@ These functions also accept the `tt(-J)', `tt(-V)', `tt(-X)', `tt(-P)', `tt(-S)', `tt(-q)', `tt(-r)', and `tt(-R)' options from the tt(compadd) builtin. -Finally, the tt(_path_files) function supports two configuration keys. -If tt(path_expand) is set to any non-empty string, the partially +Finally, the tt(_path_files) function supports one configuration key: +tt(path_expand). If this is set to any non-empty string, the partially typed path from the line will be expanded as far as possible even if -trailing pathname components can not be completed. And if -tt(path_cursor) is set to a non-empty string, the cursor will be left -after the first ambiguous pathname component even when menucompletion -is used. +trailing pathname components can not be completed. ) item(tt(_parameters))( This should be used to complete parameter names if you need some of the |