ignoring hosts in ~/.ssh/config

ignoring users and groups with start with an _
This commit is contained in:
Michael Komitee 2010-12-26 18:29:22 -05:00
commit 09dd52af81

View file

@ -35,10 +35,12 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
cdpath=(.)
# use /etc/hosts and known_hosts for hostname completion
[ -f ~/.ssh/config ] && : ${(A)ssh_config_hosts:=${${${${(@M)${(f)"$(<~/.ssh/config)"}:#Host *}#Host }:#*\**}:#*\?*}}
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r ~/.host-completion ] && : ${(A)_host_completion:=${(s: :)${(ps:\t:)${${(f)~~"$(<~/.host-completion)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _host_completion=()
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
hosts=(
"$_ssh_config_hosts[@]"
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
"$_host_completion[@]"
@ -53,14 +55,11 @@ zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
mailman mailnull mldonkey mysql nagios \
named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
operator pcap postfix postgres privoxy pulse pvm quagga radvd \
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
$(awk -F: '/^_/ { print $1 }' /etc/passwd)
zstyle ':completion:*:*:*:groups' ignored-patterns \
$(awk -F: '/^_/ { print $1 }' /etc/group)
# ... unless we really want to.
zstyle '*' single-ignored show