mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 10:21:46 +02:00
add fake-parameters style to allow completing parameters which are not yet set (12946)
This commit is contained in:
parent
bd4490b966
commit
b9f6bdf162
3 changed files with 17 additions and 5 deletions
|
@ -1,5 +1,11 @@
|
||||||
2000-10-10 Sven Wischnowsky <wischnow@zsh.org>
|
2000-10-10 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
|
* 12946: Completion/Base/_math, Completion/Base/_subscript,
|
||||||
|
Completion/Builtins/_vars, Completion/Builtins/_zstyle,
|
||||||
|
Completion/Core/_parameters, Doc/Zsh/compsys.yo: add
|
||||||
|
fake-parameters style to allow completing parameters which are not
|
||||||
|
yet set
|
||||||
|
|
||||||
* 12942,12945: Completion/Core/_expand: temporarily remove global
|
* 12942,12945: Completion/Core/_expand: temporarily remove global
|
||||||
aliases to avoid error message inside the evals
|
aliases to avoid error message inside the evals
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,4 @@ if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; then
|
||||||
SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}"
|
SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_parameters -g '(integer|float)*'
|
_parameters -g '(integer|float)*' || _parameters
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
#compdef -subscript-
|
#compdef -subscript-
|
||||||
|
|
||||||
local expl
|
local expl osuf=']'
|
||||||
|
|
||||||
|
if [[ "$1" = -q ]]; then
|
||||||
|
osuf='] '
|
||||||
|
compquote osuf
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$PREFIX" = :* ]]; then
|
if [[ "$PREFIX" = :* ]]; then
|
||||||
_wanted characters expl 'character class' \
|
_wanted characters expl 'character class' \
|
||||||
|
@ -9,7 +15,7 @@ if [[ "$PREFIX" = :* ]]; then
|
||||||
elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
|
elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
|
||||||
local suf
|
local suf
|
||||||
|
|
||||||
[[ "$RBUFFER" != \]* ]] && suf=']'
|
[[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf"
|
||||||
|
|
||||||
_wanted association-keys expl 'association key' \
|
_wanted association-keys expl 'association key' \
|
||||||
compadd -S "$suf" -k "$compstate[parameter]"
|
compadd -S "$suf" -k "$compstate[parameter]"
|
||||||
|
@ -37,12 +43,12 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
|
||||||
disp=()
|
disp=()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$RBUFFER" = \]* ]]; then
|
if [[ "$RBUFFER" = (|\\)\]* ]]; then
|
||||||
_all_labels -V indexes expl 'array index' \
|
_all_labels -V indexes expl 'array index' \
|
||||||
compadd -S '' "$disp[@]" -a ind && ret=0
|
compadd -S '' "$disp[@]" -a ind && ret=0
|
||||||
else
|
else
|
||||||
_all_labels -V indexes expl 'array index' \
|
_all_labels -V indexes expl 'array index' \
|
||||||
compadd -S ']' "$disp[@]" -a ind && ret=0
|
compadd -S "$osuf" "$disp[@]" -a ind && ret=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
_requested parameters && _parameters && ret=0
|
_requested parameters && _parameters && ret=0
|
||||||
|
|
Loading…
Reference in a new issue