about summary refs log tree commit diff
path: root/Completion/Builtins
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Builtins')
-rw-r--r--Completion/Builtins/_cd2
-rw-r--r--Completion/Builtins/_command3
-rw-r--r--Completion/Builtins/_hash4
-rw-r--r--Completion/Builtins/_kill2
-rw-r--r--Completion/Builtins/_sched2
-rw-r--r--Completion/Builtins/_setopt17
-rw-r--r--Completion/Builtins/_source3
-rw-r--r--Completion/Builtins/_unsetopt17
-rw-r--r--Completion/Builtins/_zmodload2
9 files changed, 26 insertions, 26 deletions
diff --git a/Completion/Builtins/_cd b/Completion/Builtins/_cd
index 44443c3d5..a4fd56327 100644
--- a/Completion/Builtins/_cd
+++ b/Completion/Builtins/_cd
@@ -17,7 +17,7 @@ local pushdminus
 emulate -LR zsh
 setopt extendedglob
 
-if [[ -position 3 ]]; then
+if [[ CURRENT -eq 3 ]]; then
   # cd old new: look for old in $PWD and see what can replace it
   local rep
   # Get possible completions using word in position 2
diff --git a/Completion/Builtins/_command b/Completion/Builtins/_command
index 47eb0d667..4facceb12 100644
--- a/Completion/Builtins/_command
+++ b/Completion/Builtins/_command
@@ -1,6 +1,7 @@
 #defcomp command
 
-if [[ -position 3 -1 ]]; then
+if [[ CURRENT -ge 3 ]]; then
+  compset -n 2
   _normal
 else
   compgen -em
diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash
index 8c100b801..4d4ba4244 100644
--- a/Completion/Builtins/_hash
+++ b/Completion/Builtins/_hash
@@ -1,12 +1,12 @@
 #defcomp hash
 
 if [[ "$words[2]" = -*d* ]]; then
-  if [[ -string 1 '=' ]]; then
+  if compset -P 1 '*\='; then
     _path_files -g '*(-/)'
   else
     compgen -n -q -S '='
   fi
-elif [[ -string 1 '=' ]]; then
+elif compset -P 1 '*\='; then
   _files -/g '*(*)'
 else
   compgen -m -q -S '='
diff --git a/Completion/Builtins/_kill b/Completion/Builtins/_kill
index 36a23ccb2..0b0f5c188 100644
--- a/Completion/Builtins/_kill
+++ b/Completion/Builtins/_kill
@@ -2,7 +2,7 @@
 
 local list
 
-if [[ -iprefix '-' ]]; then
+if compset -P 1 -; then
   compgen -k "($signals[1,-3])"
 else
   local ret=1
diff --git a/Completion/Builtins/_sched b/Completion/Builtins/_sched
index 62cdbb070..5fba71eac 100644
--- a/Completion/Builtins/_sched
+++ b/Completion/Builtins/_sched
@@ -1,3 +1,3 @@
 #defcomp sched
 
-[[ -position 3 -1 ]] && _normal
+compset -n 3 && _normal
diff --git a/Completion/Builtins/_setopt b/Completion/Builtins/_setopt
index b458cb2b0..e5a6c054f 100644
--- a/Completion/Builtins/_setopt
+++ b/Completion/Builtins/_setopt
@@ -1,11 +1,10 @@
 #defcomp setopt
 
-local nm=$compstate[nmatches] ret=1
-
-compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \
-         -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' && ret=0
-
-[[ compstate[nmatches] -eq nm ]] &&
-    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o && ret=0
-
-return ret
+# If you first want to complete only unset options, un-comment the lines
+# setting the _unset_options  array and then use:
+#
+#   _unset_options || _options
+#
+# here.
+
+_options
diff --git a/Completion/Builtins/_source b/Completion/Builtins/_source
index 1bbbf15a4..efac4f32b 100644
--- a/Completion/Builtins/_source
+++ b/Completion/Builtins/_source
@@ -1,6 +1,7 @@
 #defcomp source
 
-if [[ -position 3 -1 ]]; then
+if [[ CURRENT -ge 3 ]]; then
+  compset -n 2
   _normal
 else
   _files
diff --git a/Completion/Builtins/_unsetopt b/Completion/Builtins/_unsetopt
index 1194e28a7..cdc2ab9f3 100644
--- a/Completion/Builtins/_unsetopt
+++ b/Completion/Builtins/_unsetopt
@@ -1,11 +1,10 @@
 #defcomp unsetopt
 
-local nm=$compstate[nmatches] ret=1
-
-compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \
-         -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)' && ret=0
-
-[[ compstate[nmatches] -eq nm ]] &&
-    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o && ret=0
-
-return ret
+# If you first want to complete only unset options, uncomment the lines
+# setting the _set_options  array and then use:
+#
+#   _set_options || _options
+#
+# here.
+
+_options
diff --git a/Completion/Builtins/_zmodload b/Completion/Builtins/_zmodload
index 4259adf06..9247ba0ce 100644
--- a/Completion/Builtins/_zmodload
+++ b/Completion/Builtins/_zmodload
@@ -2,7 +2,7 @@
 
 local fl="$words[2]"
 
-if [[ "$fl" = -*(a*u|u*a)* || "$fl" = -*a* && -position 4 -1 ]]; then
+if [[ "$fl" = -*(a*u|u*a)* || "$fl" = -*a* && CURRENT -ge 4 ]]; then
   compgen -B
 elif [[ "$fl" = -*u* ]]; then
   compgen -s '$(zmodload)'