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

Re: problems with ssh tab completion



On Oct 9,  4:37am, Stanislaw Halik wrote:
>
> Any hints?

Firstly, note that there are some long-standing problems with completion
for ssh which stem from a deeper issue with the completion system.  See
zsh-workers/16598 and surrounding thread, from way back in 2002.

However, I *think* the problems you are describing come from using the
matcher-list zstyle that allows partial completion within words.  When
you have this style set, the completion system discovers that all the
hostname matches contain a dot, so it inserts one and then places the
cursor at one of the positions where typing something disambiguates
the results.  The position it chooses may not be the one you expect;
I think it chooses the rightmost one, where the leftmost might be more
intuitive.

In the case of

> % ssh username@.

you didn't show us the list of matches, so I can't guess why only one
dot appears and the cursor is after it.  In this example, though:

> ~% ssh sthalik@xxxxxx
> remote host name
> rodney.ltd.pl            rollercoaster.insane.pl

with the cursor between the dots, all you need to do is type either an
"l" (for "ltd") or an "i" (for "insane") and that will disambiguate the
match and allow a single additional TAB to expand the entire hostname.

If you find this useful elsewhere, such as in file names, but not in
ssh, you can change the matcher-list style just for ssh with another
zstyle command such as:

    zstyle ':completion:*:(ssh|scp):*' matcher-list ''

As for why it only happens when the username is more than four characters
long, I suspect that has to do with the set of hostnames that can complete
with the short user names, rather than anything more mysterious.



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