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/.distfiles7
-rw-r--r--Completion/Builtins/_bindkey11
-rw-r--r--Completion/Builtins/_cd13
-rw-r--r--Completion/Builtins/_disable12
-rw-r--r--Completion/Builtins/_enable12
-rw-r--r--Completion/Builtins/_kill8
-rw-r--r--Completion/Builtins/_setopt9
-rw-r--r--Completion/Builtins/_unhash12
-rw-r--r--Completion/Builtins/_unsetopt9
-rw-r--r--Completion/Builtins/_wait8
-rw-r--r--Completion/Builtins/_zftp3
11 files changed, 70 insertions, 34 deletions
diff --git a/Completion/Builtins/.distfiles b/Completion/Builtins/.distfiles
new file mode 100644
index 000000000..97906e91f
--- /dev/null
+++ b/Completion/Builtins/.distfiles
@@ -0,0 +1,7 @@
+DISTFILES_SRC='
+    .distfiles
+    _aliases _arrays _autoload _bg_jobs _bindkey _builtin _cd _command
+    _dirs _disable _echotc _enable _fc _functions _hash _jobs _kill
+    _limits _sched _set _setopt _source _trap _unhash _unsetopt _vars_eq
+    _wait _which _zftp _zle _zmodload 
+'
diff --git a/Completion/Builtins/_bindkey b/Completion/Builtins/_bindkey
index d3d019492..6fca200ba 100644
--- a/Completion/Builtins/_bindkey
+++ b/Completion/Builtins/_bindkey
@@ -1,7 +1,14 @@
 #defcomp bindkey
 
-if [[ "$words[2]" = -*[DAN]* || "$words[CURRENT-1] = -*M ]]; then
+# Normally, this completes names of zle widgets, whether the builtin ones
+# or ones defined by the user.  Note that a - allows a wildcard before it,
+# so h-b-s-b will complete to history-beginning-search-backward.  You
+# can alter this by removing the -M ... from the second compgen.
+#
+# Where appropriate, will complete keymaps instead of widgets.
+
+if [[ "$words[2]" = -*[DAN]* || "$words[CURRENT-1]" = -*M ]]; then
   compgen -s '$(bindkey -l)'
 else
-  compgen -b
+  compgen -b -M 'r:|-=* r:|=*'
 fi
diff --git a/Completion/Builtins/_cd b/Completion/Builtins/_cd
index 65ce7f293..9a58effe0 100644
--- a/Completion/Builtins/_cd
+++ b/Completion/Builtins/_cd
@@ -24,7 +24,7 @@ if [[ -position 3 ]]; then
   rep=(${~PWD/$words[2]/*}~$PWD(-/N))
   # Now remove all the common parts of $PWD and the completions from this
   rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}})
-  (( $#rep )) && compadd $rep
+  (( ! $#rep )) || compadd $rep
 elif [[ $words[1] = pu* && $PREFIX = [-+]* ]]; then
   # pushd: just complete the numbers, but show the full directory list with
   # numbers.
@@ -34,7 +34,8 @@ elif [[ $words[1] = pu* && $PREFIX = [-+]* ]]; then
   # lazy to type pushd.
   IPREFIX=$PREFIX[1]
   PREFIX=$PREFIX[2,-1]
-  local list lines
+  local list lines ret=1
+
   # get the list of directories with their canonical number
   lines="$(dirs -v)"
   # turn the lines into an array, removing the current directory
@@ -52,9 +53,11 @@ elif [[ $words[1] = pu* && $PREFIX = [-+]* ]]; then
   lines="${(F)list}"
   # get the array of numbers only
   list=(${list%%[ 	]*})
-  compgen -y '$lines' -Q -k list
-  [[ -z $compstate[list] ]] && compstate[list]=list
-  [[ -n $compstate[insert] ]] && compstat[insert]=menu
+  compgen -y '$lines' -Q -k list && ret=0
+  [[ -z $compstate[list] ]] && compstate[list]=list && ret=0
+  [[ -n $compstate[insert] ]] && compstat[insert]=menu && ret=0
+
+  return ret
 elif [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
   _path_files -W cdpath -/
 else
diff --git a/Completion/Builtins/_disable b/Completion/Builtins/_disable
index e3edafe2b..27db5c18f 100644
--- a/Completion/Builtins/_disable
+++ b/Completion/Builtins/_disable
@@ -1,8 +1,10 @@
 #defcomp disable
 
-local prev="$words[CURRENT-1]"
+local prev="$words[CURRENT-1]" ret=1
 
-[[ "$prev" = -*a* ]] && compgen -ea
-[[ "$prev" = -*f* ]] && compgen -eF
-[[ "$prev" = -*r* ]] && compgen -ew
-[[ "$prev" != -* ]] && compgen -eB
+[[ "$prev" = -*a* ]] && compgen -ea && ret=0
+[[ "$prev" = -*f* ]] && compgen -eF && ret=0
+[[ "$prev" = -*r* ]] && compgen -ew && ret=0
+[[ "$prev" != -* ]]  && compgen -eB && ret=0
+
+return ret
diff --git a/Completion/Builtins/_enable b/Completion/Builtins/_enable
index 111d1ae26..1baa09ed6 100644
--- a/Completion/Builtins/_enable
+++ b/Completion/Builtins/_enable
@@ -1,8 +1,10 @@
 #defcomp enable
 
-local prev="$words[CURRENT-1]"
+local prev="$words[CURRENT-1]" ret=1
 
-[[ "$prev" = -*a* ]] && compgen -da
-[[ "$prev" = -*f* ]] && compgen -dF
-[[ "$prev" = -*r* ]] && compgen -dw
-[[ "$prev" != -* ]] && compgen -dB
+[[ "$prev" = -*a* ]] && compgen -da && ret=0
+[[ "$prev" = -*f* ]] && compgen -dF && ret=0
+[[ "$prev" = -*r* ]] && compgen -dw && ret=0
+[[ "$prev" != -* ]]  && compgen -dB && ret=0
+
+return ret
diff --git a/Completion/Builtins/_kill b/Completion/Builtins/_kill
index c1afa78cb..36a23ccb2 100644
--- a/Completion/Builtins/_kill
+++ b/Completion/Builtins/_kill
@@ -5,7 +5,11 @@ local list
 if [[ -iprefix '-' ]]; then
   compgen -k "($signals[1,-3])"
 else
-  compgen -P '%' -j
+  local ret=1
+
+  compgen -P '%' -j && ret=0
   list=("$(ps 2>/dev/null)")
-  compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`'
+  compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' && ret=0
+
+  return ret
 fi
diff --git a/Completion/Builtins/_setopt b/Completion/Builtins/_setopt
index 98800152f..b458cb2b0 100644
--- a/Completion/Builtins/_setopt
+++ b/Completion/Builtins/_setopt
@@ -1,8 +1,11 @@
 #defcomp setopt
 
-local nm=$compstate[nmatches]
+local nm=$compstate[nmatches] ret=1
 
 compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \
-         -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)'
+         -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
+    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o && ret=0
+
+return ret
diff --git a/Completion/Builtins/_unhash b/Completion/Builtins/_unhash
index 63d61c991..a9050cb49 100644
--- a/Completion/Builtins/_unhash
+++ b/Completion/Builtins/_unhash
@@ -1,8 +1,10 @@
 #defcomp unhash
 
-local fl="$words[2]"
+local fl="$words[2]" ret=1
 
-[[ "$fl" = -*d* ]] && compgen -n
-[[ "$fl" = -*a* ]] && compgen -a
-[[ "$fl" = -*f* ]] && compgen -F
-[[ "$fl" != -* ]] && compgen -m
+[[ "$fl" = -*d* ]] && compgen -n && ret=0
+[[ "$fl" = -*a* ]] && compgen -a && ret=0
+[[ "$fl" = -*f* ]] && compgen -F && ret=0
+[[ "$fl" != -* ]]  && compgen -m && ret=0
+
+return ret
diff --git a/Completion/Builtins/_unsetopt b/Completion/Builtins/_unsetopt
index a5c85b1ef..1194e28a7 100644
--- a/Completion/Builtins/_unsetopt
+++ b/Completion/Builtins/_unsetopt
@@ -1,8 +1,11 @@
 #defcomp unsetopt
 
-local nm=$compstate[nmatches]
+local nm=$compstate[nmatches] ret=1
 
 compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \
-         -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)'
+         -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
+    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o && ret=0
+
+return ret
diff --git a/Completion/Builtins/_wait b/Completion/Builtins/_wait
index 6e3a4c3c9..9281a5cc2 100644
--- a/Completion/Builtins/_wait
+++ b/Completion/Builtins/_wait
@@ -1,7 +1,9 @@
 #defcomp wait
 
-local list
+local list ret=1
 
-compgen -P '%' -j
+compgen -P '%' -j && ret=0
 list=("$(ps 2>/dev/null)")
-compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`'
+compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' && ret=0
+
+return ret
diff --git a/Completion/Builtins/_zftp b/Completion/Builtins/_zftp
index e93021acf..178d9d9e3 100644
--- a/Completion/Builtins/_zftp
+++ b/Completion/Builtins/_zftp
@@ -45,6 +45,7 @@ case $subcom in
 
   *)
   # dunno... try ordinary completion after all.
-  unset _compskip   
+  unset _compskip
+  return 1
   ;;
 esac