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

Re: users-hosts combination failing

Peter Stephenson sent me the following 2.6K:

> > > If I type user3 and hit tab, machine4 is completed.  However, on
> > > another machine with the exact same configurtion and zsh 4.2.6, I
> > > get all machine* offered as possible completions.  I know I should
> > > probably update to a newer zsh, but is this problem known about
> > > and can anyone offer a solution?


> _ssh_hosts was altered so that it unconditionally searches the list of
> hosts in the configuration file.  The documentation of the users-hosts
> style is quite clear that it shouldn't if there was a match there:


> So the behaviour is wrong.  This patch makes _ssh_hosts return if
> users-hosts matches.

Perfect!  (Sorry, Bart, for dismissing your previous patch.  I didn't
realize the completion code was in plain text on my system and not in
some compiled form.)  My version didn't look exactly like this, but
tacking the "&& return" onto the end of the two _combination commands
does the trick.  It looks like those were the only two lines that

> +  # If users-hosts matches, we shouldn't complete anything else.
>    if [[ "$IPREFIX" == *@ ]]; then
> -    _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@"
> +    _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return
>    else
>      _combination -s '[:@]' my-accounts users-hosts \
> -      ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@"
> +      ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return

Thanks so much, Peter!

Chris Johnson

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