about summary refs log tree commit diff
path: root/Completion/Zsh
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Zsh')
-rw-r--r--Completion/Zsh/Command/_setopt22
-rw-r--r--Completion/Zsh/Command/_unsetopt10
2 files changed, 14 insertions, 18 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
diff --git a/Completion/Zsh/Command/_unsetopt b/Completion/Zsh/Command/_unsetopt
deleted file mode 100644
index 75a33e9dd..000000000
--- a/Completion/Zsh/Command/_unsetopt
+++ /dev/null
@@ -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