From 427a03856f58f898ae477f617ea4a7cecae8e3b9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 17 Aug 2013 04:33:12 -0400 Subject: [PATCH] Fix ssh hostname autocomplete for zsh --- zsh/completion | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/completion b/zsh/completion index cab38b60..fe22d074 100644 --- a/zsh/completion +++ b/zsh/completion @@ -1,6 +1,8 @@ autoload -Uz compinit && compinit # Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards -[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh +if [ -e "$HOME/.ssh/config" ]; then + zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' +fi # vim:set ft=zsh: