about summary refs log tree commit diff
path: root/Completion
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
parent438a49c8d7a105b5e0b24eb3f658cad14df841c4 (diff)
downloadzsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.tar.gz
zsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.tar.xz
zsh-4777e2acd41ad06d172ff06e2ff989fdeee3e19b.zip
zsh-workers/8515
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/_command_names2
-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
-rw-r--r--Completion/User/_gdb9
-rw-r--r--Completion/User/_perldoc2
9 files changed, 39 insertions, 14 deletions
diff --git a/Completion/Base/_command_names b/Completion/Base/_command_names
index a640e196b..5ec984bdc 100644
--- a/Completion/Base/_command_names
+++ b/Completion/Base/_command_names
@@ -15,7 +15,7 @@ fi
 
 # Complete jobs in implicit fg and bg
 if [[ -z "$ext" && "$PREFIX[1]" = "%" ]]; then
-  _job -P '%'
+  _jobs
   [[ nm -ne compstate[nmatches] ]] && return
 fi
 
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'
diff --git a/Completion/User/_gdb b/Completion/User/_gdb
index fc882ff90..22242caff 100644
--- a/Completion/User/_gdb
+++ b/Completion/User/_gdb
@@ -1,8 +1,5 @@
 #compdef gdb
 
-# This uses the configuration keys `ps_args' and `ps_listargs'
-# described in the `_wait' function.
-
 local cur="$words[CURRENT]" prev w list ret=1 expl
 
 [[ "$PREFIX" = --* ]] &&
@@ -17,7 +14,7 @@ elif compset -P '-tty='; then
   compadd "$expl[@]" - /dev/tty*
 elif compset -P '-(exec|se)='; then
   _description expl executable
-  _files "$expl[@]" -/g '*(*)'
+  _files "$expl[@]" -g '*(*)'
 elif compset -P '-(symbols|core|command)='; then
   _files
 elif [[ "$PREFIX" = -* ]]; then
@@ -33,7 +30,7 @@ else
   (-d) _files -/ && return 0 ;;
   (-[csx]) _files && return 0 ;;
   (-e) _description expl executable
-       _files "$expl[@]" -/g '*(*)' && return 0 ;;
+       _files "$expl[@]" -g '*(*)' && return 0 ;;
   (-b) _description -V expl 'baud rate'
        compadd "$expl[@]" 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \
                           9600 19200 38400 57600 115200 230400 && return 0 ;;
@@ -53,6 +50,6 @@ else
     return ret
   else
     _description expl executable
-    _files "$expl[@]" -/g '*(*)'
+    _files "$expl[@]" -g '*(*)'
   fi
 fi
diff --git a/Completion/User/_perldoc b/Completion/User/_perldoc
index 54f0d9c08..62fd18ca7 100644
--- a/Completion/User/_perldoc
+++ b/Completion/User/_perldoc
@@ -21,7 +21,7 @@ _perl_pods () {
   _perl_basepods
 
   _description expl 'Perl modules and .pods'
-  _path_files "$expl[@]"  -/ -g '*.(pod|pm)'
+  _files "$expl[@]"  -g '*.(pod|pm)'
 
   [[ nm -ne "$compstate[nmatches]" ]]
 }