From: Christian Hesse Date: Mon, 18 May 2015 21:44:17 +0000 (+0200) Subject: fix ssh remote host name completion with more than one pattern X-Git-Tag: v0.12.0~5 X-Git-Url: https://git.grml.org/?p=grml-etc-core.git;a=commitdiff_plain;h=e3f3b08c2e641279e80235e739c3136d8cccac49 fix ssh remote host name completion with more than one pattern Host declaration may contain more than one pattern given after the keyword, separated by whitespaces. For correct completion split the string. Signed-off-by: Christian Hesse --- diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 61246b7..be62172 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -769,7 +769,7 @@ grmlcomp() { # host completion if is42 ; then - [[ -r ~/.ssh/config ]] && _ssh_config_hosts=(${${${(@M)${(f)"$(<$HOME/.ssh/config)"}:#Host *}#Host }:#*[*?]*}) || _ssh_config_hosts=() + [[ -r ~/.ssh/config ]] && _ssh_config_hosts=(${${(s: :)${(ps:\t:)${${(@M)${(f)"$(<$HOME/.ssh/config)"}:#Host *}#Host }}}:#*[*?]*}) || _ssh_config_hosts=() [[ -r ~/.ssh/known_hosts ]] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() [[ -r /etc/hosts ]] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(