From da71ac4fcd36572e7de38a565132611052e51587 Mon Sep 17 00:00:00 2001 From: Shahar Mintz Date: Mon, 10 Dec 2012 16:09:27 +0200 Subject: [PATCH] fix auto completion for ssh hosts when saved with non standard port in known_hosts --- modules/completion/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index de59a5d2..e023d713 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -96,7 +96,7 @@ zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-va # Populate hostname completion. zstyle -e ':completion:*:hosts' hosts 'reply=( - ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//,/ } + ${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/}//\[/} ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*} ${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}} )'