summary refs log tree commit diff
path: root/Completion/User/_hosts
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_hosts')
-rw-r--r--Completion/User/_hosts14
1 files changed, 12 insertions, 2 deletions
diff --git a/Completion/User/_hosts b/Completion/User/_hosts
index 3acc327ac..30c3b2357 100644
--- a/Completion/User/_hosts
+++ b/Completion/User/_hosts
@@ -1,3 +1,13 @@
-#defcomp ftp ncftp ping rwho rup xping traceroute nslookup
+#compdef ftp ncftp ping rwho rup xping traceroute host
 
-complist -k hosts
+local expl hosts
+
+if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
+  (( $+_cache_hosts )) ||
+      : ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
+
+  hosts=( "$_cache_hosts[@]" )
+fi
+
+_wanted hosts expl host \
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a hosts