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

Re: Ssh completion from ~/.ssh/config



Thank you for the tip, Vadim. This solves my problem, in a way.

However, the existing _ssh file already has working code for parsing the
.ssh/config file. Code which is far more readable, and doesn't require me
to parse it myself with that hosts definition. For some reason though,
someone has decided that it is not to be used. I would still prefer it if
there was some way of configuring that I want to use the code that is
already written, and that I prefer .ssh/config over .ssh/known_hosts.


On Tue, Apr 7, 2015 at 4:27 PM, Vadim A. Misbakh-Soloviov <mva@xxxxxxxx>
wrote:

> ```
>   # 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*'
>
>
> ```


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