diff options
author | Florian Pritz <bluewind@xinu.at> | 2019-06-25 10:05:42 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2019-07-06 14:19:22 +0200 |
commit | 7846794b6cd433e382c0a064f6f648937e2f8ac5 (patch) | |
tree | df57db4b53fdeb18009456c4ded2666649b68fe1 | |
parent | ad746c2032c713fd6c57bcc8e601ab43704e1fa9 (diff) | |
download | dotfiles-7846794b6cd433e382c0a064f6f648937e2f8ac5.tar.gz dotfiles-7846794b6cd433e382c0a064f6f648937e2f8ac5.tar.xz |
zshrc: Autocomplete ssh hosts at work
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | .zshrc | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -690,6 +690,7 @@ compdef sshrc=ssh # complete ssh hostnames [[ -r ~/.ssh/known_hosts ]] && _ssh_hosts=(${${${${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}%%:*}#\[}%\]}) || _ssh_hosts=() +[[ -r ~/.ssh/known_hosts_work ]] && _ssh_hosts+=(${${${${${${${(f)"$(sed -r 's#_(rsa|ed25519|ecdsa),#,#;' <$HOME/.ssh/known_hosts_work)"}:#[\|]*}%%\ *}%%,*}%%:*}#\[}%\]}) || true [[ -r ~/.ssh/config ]] && _ssh_config_hosts=($(sed -rn 's/host\s+(.+)/\1/ip' "$HOME/.ssh/config" | grep -v "\*" )) || _ssh_config_hosts=() hosts=( $HOST |