diff options
author | Florian Pritz <bluewind@xssn.at> | 2010-08-12 22:54:00 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xssn.at> | 2010-08-12 22:54:00 +0200 |
commit | 42b3b725deef4ee1cdc5e886538ad565cf086e95 (patch) | |
tree | 25ebb02f04e371a70281ecc6f85b72c096c04f58 | |
parent | 398e3cc2e7d73ad8f2619f4750973873a10bbc2b (diff) | |
download | dotfiles-42b3b725deef4ee1cdc5e886538ad565cf086e95.tar.gz dotfiles-42b3b725deef4ee1cdc5e886538ad565cf086e95.tar.xz |
zshrc: add better ssh/scp completion
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-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 |