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

Re: ssh host completion



Thanks, the first context suggestion worked.

/John

On Wed, Mar 21, 2018 at 5:26 PM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:

> On 27 Feb, John Benninghoff wrote:
> > the host names configured in my ~/.ssh/config file.  I use the following
> > section in my .zshrc file to try to get the desired behavior:
> >
> >       if [[ -r ~/.ssh/config ]]; then
> >          sconf=( $(sed -n '/^Host[=\t ]/{s///;s/#.*//;p;}'
> ~/.ssh/config) )
> >          zstyle ':completion::complete:ssh:argument-1:' tag-order !users
> >          zstyle ':completion::*:ssh:*:' hosts $sconf
>
> I think the context for this zstyle won't match. Try something like:
>   zstyle ':completion::*:ssh:*:hosts' hosts $sconf
> or perhaps just:
>   zstyle ':completion::*:ssh:*' hosts $sconf
>
> If that doesn't help, try experimenting with the users-hosts style. That
> needs a context like ':completion:*:ssh:*:my-accounts'. It also expects
> usernames in the style values.
>
> >          # Use ^Xh to see context and tags applicable in CLI position
>
> Also useful is ^X? to do a full trace. If you view the trace with less,
> filtering it with & can be very useful.
>
> >         :completion::complete:ssh:argument-1: !users
>
> A similar but slightly different option is to just hide the users:
>   zstyle ':completion:*:ssh:*:users' hidden true
>
> Sorry that your message didn't get answered sooner.
>
> Oliver
>


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