about summary refs log tree commit diff
path: root/Completion/Builtins
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-03 10:48:39 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-03 10:48:39 +0000
commit4777e2acd41ad06d172ff06e2ff989fdeee3e19b (patch)
tree53c0ec7aab30f9e1ad6cf618be54f0223e608c00 /Completion/Builtins
parent438a49c8d7a105b5e0b24eb3f658cad14df841c4 (diff)
downloadzsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.tar.gz
zsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.tar.xz
zsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.zip
zsh-workers/8515
Diffstat (limited to 'Completion/Builtins')
-rw-r--r--Completion/Builtins/_bg_jobs2
-rw-r--r--Completion/Builtins/_fg_jobs3
-rw-r--r--Completion/Builtins/_hash3
-rw-r--r--Completion/Builtins/_jobs28
-rw-r--r--Completion/Builtins/_kill2
-rw-r--r--Completion/Builtins/_wait2
6 files changed, 34 insertions, 6 deletions
diff --git a/Completion/Builtins/_bg_jobs b/Completion/Builtins/_bg_jobs
index 6d6a8fcc4..4362f8949 100644
--- a/Completion/Builtins/_bg_jobs
+++ b/Completion/Builtins/_bg_jobs
@@ -1,3 +1,3 @@
 #compdef bg
 
-_job -s -P '%'
+_jobs -s
diff --git a/Completion/Builtins/_fg_jobs b/Completion/Builtins/_fg_jobs
new file mode 100644
index 000000000..4db38045e
--- /dev/null
+++ b/Completion/Builtins/_fg_jobs
@@ -0,0 +1,3 @@
+#compdef disown fg jobs
+
+_jobs
diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash
index c06d63699..4cb72b09c 100644
--- a/Completion/Builtins/_hash
+++ b/Completion/Builtins/_hash
@@ -10,7 +10,8 @@ if [[ "$words[2]" = -*d* ]]; then
     compadd "$expl[@]" -q -S '=' - "${(@k)nameddirs}"
   fi
 elif compset -P 1 '*\='; then
-  _files -/g '*(*)'
+  _description expl 'executable file'
+  _files "$expl[@]" -g '*(*)'
 else
   _description expl command
   compadd "$expl[@]" -q -S '=' - "${(@k)commands}"
diff --git a/Completion/Builtins/_jobs b/Completion/Builtins/_jobs
index c17b73c92..869aeeb8a 100644
--- a/Completion/Builtins/_jobs
+++ b/Completion/Builtins/_jobs
@@ -1,3 +1,27 @@
-#compdef disown fg jobs
+#autoload
+
+local expl disp jobs job jids
+
+if [[ "$1" = -r ]]; then
+  jids=( "${(@k)jobstates[(R)running*]}" )
+  shift
+  _description expl 'running job'
+elif [[ "$1" = -s ]]; then
+  jids=( "${(@k)jobstates[(R)running*]}" )
+  shift
+  _description expl 'suspended job'
+else
+  [[ "$1" = - ]] && shift
+  jids=( "${(@k)jobtexts}" )
+  _description expl job
+fi
+
+disp=()
+jobs=()
+for job in "$jids[@]"; do
+  disp=( "$disp[@]" "${(l:3:: ::%:)job} -- ${jobtexts[$job]}" )
+  jobs=( "$jobs[@]" "$job" )
+done
+
+compadd "$@" "$expl[@]" -ld disp - "%$^jobs[@]"
 
-_job -P '%'
diff --git a/Completion/Builtins/_kill b/Completion/Builtins/_kill
index b79bfd6c0..2af168f3f 100644
--- a/Completion/Builtins/_kill
+++ b/Completion/Builtins/_kill
@@ -8,7 +8,7 @@ if compset -P 1 -; then
 else
   local ret=1
 
-  _job && ret=0
+  _jobs && ret=0
 
   list=("${(@M)${(f@)$(ps ${=compconfig[ps_listargs]:-$=compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ 	]#${PREFIX}[0-9]#${SUFFIX}[ 	]*}")
   _description expl 'process ID'
diff --git a/Completion/Builtins/_wait b/Completion/Builtins/_wait
index 68ca187e8..b659532e7 100644
--- a/Completion/Builtins/_wait
+++ b/Completion/Builtins/_wait
@@ -2,7 +2,7 @@
 
 local list ret=1 expl
 
-_job -P '%' && ret=0
+_jobs && ret=0
 
 list=("${(@M)${(f)$(ps ${=compconfig[ps_listargs]:-$=compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ 	]#${PREFIX}[0-9]#${SUFFIX}[ 	]*}")
 _description expl 'process ID'