Browse code

Added support for entries in /etc/ssh/ssh_known_hosts.

Kyle Smith authored on 22/12/2011 at 19:02:01
Showing 1 changed files
... ...
@@ -32,9 +32,11 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
32 32
 cdpath=(.)
33 33
 
34 34
 # use /etc/hosts and known_hosts for hostname completion
35
+[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
35 36
 [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
36 37
 [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
37 38
 hosts=(
39
+  "$_global_ssh_hosts[@]"
38 40
   "$_ssh_hosts[@]"
39 41
   "$_etc_hosts[@]"
40 42
   `hostname`