diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index 12b2023..80bef9b 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -92,3 +92,8 @@ zstyle ':completion:*:history-words' menu yes # ignore multiple entries. zstyle ':completion:*:(rm|kill|diff):*' ignore-line other zstyle ':completion:*:rm:*' file-patterns '*:all-files' + +# If the _my_hosts function is defined, it will be called to add the ssh hosts +# completion, otherwise _ssh_hosts will fall through and read the ~/.ssh/config +zstyle -e ':completion:*:*:ssh:*:my-accounts' users-hosts \ + '[[ -f ${HOME}/.ssh/config && ${key} == hosts ]] && key=my_hosts reply=()'