51-completion-awit-ssh.zsh 414 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
# compsys initialization
autoload -U compinit
compinit

# Get an array of known SSH host names after deleting:
# - Everything after the first column of host names or IPs
# - Square brackets and attached port numbers
# - IP addresses
# - Encrypted host names
hosts=( `sed -e 's/[, ].*//g' -e 's/\[\([^]]*\)\].*/\1/' -e '/^[0-9]\+/d' -e '/^|1|/d' $HOME/.ssh/known_hosts` )

zstyle ':completion:*:hosts' hosts $hosts