1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-21 18:21:01 +02:00

33061: More useful setopt / unsetopt completion

This commit is contained in:
Mikael Magnusson 2014-08-28 11:33:53 +02:00
parent 3518783680
commit c61a927d1d
3 changed files with 20 additions and 18 deletions
ChangeLog
Completion/Zsh/Command

View file

@ -1,3 +1,9 @@
2014-08-21 Mikael Magnusson <mikachu@gmail.com>
* 33061: Completion/Zsh/Command/_setopt,
Completion/Zsh/Command/_unsetopt: More useful setopt / unsetopt
completion.
2014-09-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 33110: Doc/Zsh/expn.yo: document use of $IFS[1] for variable

View file

@ -1,10 +1,16 @@
#compdef setopt
#compdef setopt unsetopt
# If you first want to complete only unset options, un-comment the lines
# setting the _options_unset array and then use:
#
# _options_unset || _options
#
# here.
local expl ret=1
local -a onopts offopts
onopts=( ${(k)_comp_caller_options[(R)on]} )
offopts=( ${(k)_comp_caller_options[(R)off]} )
case $service in
setopt) onopts=(no$onopts) ;;
unsetopt) offopts=(no$offopts) ;;
esac
_wanted zsh-options expl 'zsh options (set)' \
compadd -J 'enabled options' -M 'M:_= M:{A-Z}={a-z}' -k - onopts && ret=0
_wanted zsh-options expl 'zsh options (unset)' \
compadd -J 'disabled options' -M 'M:_= M:{A-Z}={a-z}' -k - offopts && ret=0
_options
return ret

View file

@ -1,10 +0,0 @@
#compdef unsetopt
# If you first want to complete only unset options, uncomment the lines
# setting the _options_set array and then use:
#
# _options_set || _options
#
# here.
_options