about summary refs log tree commit diff
path: root/Completion/Zsh/Command/_setopt
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2014-08-28 11:33:53 +0200
committerMikael Magnusson <mikachu@gmail.com>2014-09-06 11:01:12 +0200
commitc61a927d1d156731d9e21c714dfea9585163c556 (patch)
tree5a782fb917a7d486279d39bdf9b07294ed15ab64 /Completion/Zsh/Command/_setopt
parent3518783680573a19bb54aa29c6d5a9359fbcc791 (diff)
downloadzsh-c61a927d1d156731d9e21c714dfea9585163c556.tar.gz
zsh-c61a927d1d156731d9e21c714dfea9585163c556.tar.xz
zsh-c61a927d1d156731d9e21c714dfea9585163c556.zip
33061: More useful setopt / unsetopt completion
Diffstat (limited to 'Completion/Zsh/Command/_setopt')
-rw-r--r--Completion/Zsh/Command/_setopt22
1 files changed, 14 insertions, 8 deletions
diff --git a/Completion/Zsh/Command/_setopt b/Completion/Zsh/Command/_setopt
index f72c20dda..fb38d1da6 100644
--- a/Completion/Zsh/Command/_setopt
+++ b/Completion/Zsh/Command/_setopt
@@ -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