fix ssh remote host name completion with more than one pattern
authorChristian Hesse <mail@eworm.de>
Mon, 18 May 2015 21:44:17 +0000 (23:44 +0200)
committerChristian Hesse <mail@eworm.de>
Wed, 27 May 2015 07:02:26 +0000 (09:02 +0200)
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 <mail@eworm.de>
etc/zsh/zshrc

index 61246b7..be62172 100644 (file)
@@ -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)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
     else