diff options
-rw-r--r-- | .zshrc | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -688,6 +688,20 @@ zstyle ':completion:*:rm:*' file-patterns '*:all-files' zstyle ':completion:*:wine:*' file-patterns '*.(exe|EXE):exe' +# don't complete usernames (the come from localhost!) +zstyle ':completion:*:(ssh|scp):*' users + +# complete ssh hostnames +[[ -r ~/.ssh/known_hosts ]] && _ssh_hosts=(${${${${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}%%:*}#\[}%\]}) || _ssh_hosts=() +[[ -r ~/.ssh/config ]] && _ssh_config_hosts=($(sed -rn 's/host\s+(.+)/\1/ip' "$HOME/.ssh/config" | grep -v "\*" )) || _ssh_config_hosts=() +hosts=( + $(hostname) + "$_ssh_hosts[@]" + $_ssh_config_hosts[@] + localhost + ) +zstyle ':completion:*:hosts' hosts $hosts + # automagic url quoter autoload -U url-quote-magic zle -N self-insert url-quote-magic |