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

Re: Ssh completion from ~/.ssh/config



Thank you Bart, that works perfectly!


On Wed, Apr 8, 2015 at 6:47 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:

> On Apr 7,  8:37pm, Jesper Nygards wrote:
> }
> } 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.
>
> Try this:
>
>     zstyle -e ':completion:*:*:ssh:*:my-accounts' users-hosts \
>         '[[ -f ~/.ssh/config && $key = hosts ]] && key=my_hosts reply=()'
>
> You can then either define the function _my_hosts which will be called to
> add the host completions, or _ssh_hosts will fall through to the code that
> reads the .ssh/config files.
>


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