diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-25 15:43:41 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-25 15:43:41 +0000 |
commit | 206237c8ec4b7619d9e70a75004cd1ae1066b0a0 (patch) | |
tree | ff703cbc295605f90755edb68672ed2de11f4a81 /Completion/Core/compinit | |
parent | 8ceb54fbc2f879e0e80f58c18761bd54db07e5f7 (diff) | |
download | zsh-206237c8ec4b7619d9e70a75004cd1ae1066b0a0.tar.gz zsh-206237c8ec4b7619d9e70a75004cd1ae1066b0a0.tar.xz zsh-206237c8ec4b7619d9e70a75004cd1ae1066b0a0.zip |
zsh-3.1.5-pws-16 zsh-3.1.5-pws-16-w6109 dot-zsh-199904280524
Diffstat (limited to 'Completion/Core/compinit')
-rw-r--r-- | Completion/Core/compinit | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/Completion/Core/compinit b/Completion/Core/compinit index 20b1262ec..72d5fde28 100644 --- a/Completion/Core/compinit +++ b/Completion/Core/compinit @@ -217,15 +217,30 @@ compdef() { # With the option `-l' as the first argument, the other arguments are # taken to be key names and the values for theses keys are printed, one # per line. +# When listing is done and the `-L' option is given, the keys and +# values are printed as invocations for this function, usable to be put +# inte a setup script. compconf() { - local i + local i opt list + + while getopts "lL" opt; do + if [[ "$opt" = l ]]; then + [[ -z "$list" ]] && list=yes + else + list=long + fi + done + shift OPTIND-1 if (( $# )); then - if [[ "$1" = -l ]]; then - shift + if [[ -n $list ]]; then for i; do - print $compconfig[$i] + if [[ $list = long ]]; then + (( ${+compconfig[$i]} )) && print "compconf $i='$compconfig[$i]'" + else + print $compconfig[$i] + fi done else for i; do @@ -238,20 +253,19 @@ compconf() { fi else for i in ${(k)compconfig}; do - print ${(r:25:)i} $compconfig[$i] + if [[ $list = long ]]; then + print "compconf $i='$compconfig[$i]'" + else + print ${(r:25:)i} $compconfig[$i] + fi done fi } # Now we automatically make the definition files autoloaded. -if [[ ! -o extendedglob ]]; then - _i_noextglob=yes - setopt extendedglob -fi - typeset -U _i_files -_i_files=( ${^~fpath}/_*~*~(N:t) ) +_i_files=( ${^~fpath}/_(|*[^~])(N:t) ) _i_initname=$0 _i_done='' @@ -268,7 +282,7 @@ fi if [[ -z "$_i_done" ]]; then for _i_dir in $fpath; do [[ $_i_dir = . ]] && continue - for _i_file in $_i_dir/_*~*~(N); do + for _i_file in $_i_dir/_(|*[^~])(N); do read -rA _i_line < $_i_file _i_tag=$_i_line[1] shift _i_line @@ -306,6 +320,4 @@ if [[ -z "$_i_done" ]]; then (( _i_autodump )) && builtin . ${_i_initname:h}/compdump fi -[[ -z "$_i_noextglob" ]] || unsetopt extendedglob - -unset _i_files _i_initname _i_done _i_autodump _i_noextglob +unset _i_files _i_initname _i_done _i_autodump |