Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Ssh completion from ~/.ssh/config



07.04.2015, 17:34, "Vadim A. Misbakh-Soloviov" <mva@xxxxxxxx>:
> ```
>   # Hostnames completion.
>   zstyle -e ':completion:*:hosts' hosts 'reply=(
>     ${${${${${(f)"$(<${HOME}/.ssh/known_hosts)"//\[/}//\]:/ }:#[\|]*}%%\
> *}%%,*}
>     ${${${(@M)${(f)"$(<${HOME}/.ssh/config)"}:#Host *}#Host }:#*[*?]*}
>     ${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}#*[[:blank:]]}}
>   )'
>   zstyle ':completion:*:*:*:hosts' ignored-patterns 'ip6*' 'localhost*'
>
> ```

  ssh_config Host statement can contains many names separated by whitespaces.
  So ${${${(@M)${(f)"$(<${HOME}/.ssh/config)"}:#Host *}#Host }:#*[*?]*} should be
  ${(s. .)${${${(@M)${(f)"$(<${HOME}/.ssh/config)"}:#Host *}#Host }:#*[*?]*}}, i suppose.


-- 
wbw, artur



Messages sorted by: Reverse Date, Date, Thread, Author