#compdef ftp ping rwho rup xping traceroute host local expl hosts if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then (( $+_cache_hosts )) || : ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(host -l $(awk '/search/ { print $2 }' < /etc/resolv.conf) 2>/dev/null | awk '{ print $3, $1}')"}%%\#*}##[:blank:]#[^[:blank:]]#}}} hosts=( "$_cache_hosts[@]" ) fi _wanted hosts expl host \ compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a hosts