diff options
| author | Peter Stephenson <pws@users.sourceforge.net> | 2000-04-01 20:43:43 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@users.sourceforge.net> | 2000-04-01 20:43:43 +0000 |
| commit | e025336f2f6d9f107ee1e03b9900f04af0544ba9 (patch) | |
| tree | 37b0ce74587d42d4bcb024991526d2361fcdf04a /Completion/Core/compinit | |
| parent | Initial revision (diff) | |
| download | zsh-e025336f2f6d9f107ee1e03b9900f04af0544ba9.tar zsh-e025336f2f6d9f107ee1e03b9900f04af0544ba9.tar.gz zsh-e025336f2f6d9f107ee1e03b9900f04af0544ba9.tar.bz2 zsh-e025336f2f6d9f107ee1e03b9900f04af0544ba9.tar.lz zsh-e025336f2f6d9f107ee1e03b9900f04af0544ba9.tar.xz zsh-e025336f2f6d9f107ee1e03b9900f04af0544ba9.tar.zst zsh-e025336f2f6d9f107ee1e03b9900f04af0544ba9.zip | |
Updated from list as far as 10376
Diffstat (limited to 'Completion/Core/compinit')
| -rw-r--r-- | Completion/Core/compinit | 427 |
1 files changed, 331 insertions, 96 deletions
diff --git a/Completion/Core/compinit b/Completion/Core/compinit index ec5867838..6a35d17a7 100644 --- a/Completion/Core/compinit +++ b/Completion/Core/compinit @@ -1,25 +1,23 @@ # Initialisation for new style completion. This mainly contains some helper -# function and aliases. Everything else is split into different files in this -# directory that will automatically be made autoloaded (see the end of this -# file). +# functions and aliases. Everything else is split into different files that +# will automatically be made autoloaded (see the end of this file). # The names of the files that will be considered for autoloading have to -# start with a underscores (like `_setopt). +# start with an underscores (like `_setopt'). # The first line of these files will be read and has to say what should be # done with its contents: # -# `#defcomp <names ...>' -# if the first line looks like this, the file is -# autoloaded as a function and that function will -# be called to generate the matches when completing -# for one of the commands whose <name> is given +# `#compdef <names ...>' +# If the first line looks like this, the file is autoloaded as a +# function and that function will be called to generate the matches +# when completing for one of the commands whose <names> are given. # -# `#defpatcomp <pattern>' -# this defines a function that should be called to generate -# matches for commands whose name matches <pattern>; note -# that only one pattern may be given +# `#compdef -p <pattern>' +# This defines a function that should be called to generate matches +# for commands whose name matches <pattern>. Note that only one pattern +# may be given. # -# `#defkeycomp <style> [ <key-sequence> ... ] -# this is used to bind special completions to all the given +# `#compdef -k <style> [ <key-sequence> ... ]' +# This is used to bind special completions to all the given # <key-sequence>(s). The <style> is the name of one of the built-in # completion widgets (complete-word, delete-char-or-list, # expand-or-complete, expand-or-complete-prefix, list-choices, @@ -29,35 +27,89 @@ # rather than by the context. The widget has the same name as # the autoload file and can be bound using bindkey in the normal way. # -# `#autoload' -# this is for helper functions that are not used to +# `#compdef -K <widget-name> <style> <key-sequence> [ ... ]' +# This is similar to -k, except it takes any number of sets of +# three arguments. In each set, the widget <widget-name> will +# be defined, which will behave as <style>, as with -k, and will +# be bound to <key-sequence>, exactly one of which must be defined. +# <widget-name> must be different for each: this must begin with an +# underscore, else one will be added, and should not clash with other +# completion widgets (names based on the name of the function are the +# clearest), but is otherwise arbitrary. It can be tested in the +# function by the parameter $WIDGET. +# +# `#autoload [ <options> ]' +# This is for helper functions that are not used to # generate matches, but should automatically be loaded -# when they are called +# when they are called. The <options> will be given to the +# autoload builtin when making the function autoloaded. Note +# that this need not include `-U'. # # Note that no white space is allowed between the `#' and the rest of # the string. # -# See the file `compdump' for how to speed up initialiation. -# -# If you are using global matching specifications with `compctl -M ...' -# have a look at the files `_match_test' and `_match_pattern'. To make -# all the example functions use matching as specified with `-M' these -# need some editing. +# Functions that are used to generate matches should return zero if they +# were able to add matches and non-zero otherwise. # +# See the file `compdump' for how to speed up initialisation. + # If we got the `-d'-flag, we will automatically dump the new state (at -# the end). +# the end). This takes the dumpfile as an argument. -d (with the +# default dumpfile) is now the default; to turn off dumping use -D. + +emulate -L zsh +setopt extendedglob + +typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1 +typeset _i_tag _i_file _i_addfiles + +while [[ $# -gt 0 && $1 = -[dDf] ]]; do + if [[ "$1" = -d ]]; then + _i_autodump=1 + shift + if [[ $# -gt 0 && "$1" != -[df] ]]; then + _i_dumpfile="$1" + shift + fi + elif [[ "$1" = -D ]]; then + _i_autodump=0 + shift + elif [[ "$1" = -f ]]; then + # Not used any more; use _compdir + shift + shift + fi +done -if [[ "$1" = -d ]]; then - _i_autodump=1 +# The associative array containing the definitions for the commands. +# Definitions for patterns will be stored in the associations `_patcomps' +# and `_postpatcomps'. `_compautos' contains the names and options +# for autoloaded functions that get options. + +typeset -gA _comps _patcomps _postpatcomps _compautos + +# The associative array use to report information about the last +# cmpletion to the outside. + +typeset -gA _lastcomp + +# Remember dumpfile. +if [[ -n $_i_dumpfile ]]; then + # Explicitly supplied dumpfile. + _comp_dumpfile="$_i_dumpfile" |
