d8521693f4e2c140391065e7b721d7452134259f
- Author
- Kyle Smith <askreet@gmail.com>
- Committer
- Kyle Smith <askreet@gmail.com>
- Date
Message
Added support for entries in /etc/ssh/ssh_known_hosts.
Diff
1diff --git a/lib/completion.zsh b/lib/completion.zsh
2index b3cc918229ce3cdf60f6434cda1ecf1e7a385a77..0e5d480ff4923f147ac2355504f16f068116c720 100644
3--- a/lib/completion.zsh
4+++ b/lib/completion.zsh
5@@ -32,9 +32,11 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
6 cdpath=(.)
7
8 # use /etc/hosts and known_hosts for hostname completion
9+[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
10 [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
11 [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
12 hosts=(
13+ "$_global_ssh_hosts[@]"
14 "$_ssh_hosts[@]"
15 "$_etc_hosts[@]"
16 `hostname`