# 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