zsh-users
 help / color / mirror / code / Atom feed
* problems with ssh tab completion
@ 2006-10-09  2:37 Stanislaw Halik
  2006-10-09 15:01 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislaw Halik @ 2006-10-09  2:37 UTC (permalink / raw)
  To: zsh-users

I'm having problems with Tab completion script for ssh.

When I execute a zstyle line:

zstyle ':completion:*' hosts

to only use hosts from ~/.ssh/config, omitting ones in /etc/hosts, and
type:

% ssh username@^I

I get:

% ssh username@.

with a literal dot after the '@' sign. The host list is displayed after
another Tab key press. However, typing characters won't help to
disambiguate the list, as the leading '.' is there. Why is it being
displayed?

Strangely enough, it only happens if the username portion is longer than
4 characters.

The second problem occurs after matching multiple similar hosts, such as
ones I connect to: "rollercoaster.insane.pl" and "rodney.ltd.pl".
Typing:

% ssh sthalik@ro^I

yields:

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

with the cursor placed between two dots.

I'd like it to just omit the '..pl' portion, as I find this kind of
completion confusing.

Oddly enough, it only happens if I specify the username portion and the
'@' sign.

I'm using zsh 4.3.2.

Any hints?
-- sh


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problems with ssh tab completion
  2006-10-09  2:37 problems with ssh tab completion Stanislaw Halik
@ 2006-10-09 15:01 ` Bart Schaefer
  2006-10-09 22:23   ` Stanislaw Halik
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2006-10-09 15:01 UTC (permalink / raw)
  To: zsh-users

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@ro..pl
> 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problems with ssh tab completion
  2006-10-09 15:01 ` Bart Schaefer
@ 2006-10-09 22:23   ` Stanislaw Halik
  2006-10-10 15:47     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislaw Halik @ 2006-10-09 22:23 UTC (permalink / raw)
  To: zsh-users

On Mon, Oct 09, 2006, Bart Schaefer wrote:
> [...]

Thank you for an explanation.

> 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 ''

Right now I'm using the following matcher-list:

zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z} m:{a-zA-Z}={A-Za-z}'

However, both disabling this matcher-list completely and entering the
one you specified seems to have no effect. Hostnames, as previously,
are delimited with dots as "delimiters" of some sort.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problems with ssh tab completion
  2006-10-09 22:23   ` Stanislaw Halik
@ 2006-10-10 15:47     ` Bart Schaefer
  2006-10-10 16:26       ` Stanislaw Halik
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2006-10-10 15:47 UTC (permalink / raw)
  To: zsh-users

On Oct 10, 12:23am, Stanislaw Halik wrote:
}
} However, both disabling this matcher-list completely and entering the
} one you specified seems to have no effect. Hostnames, as previously,
} are delimited with dots as "delimiters" of some sort.

I'm out of ideas at the moment and don't have enough details of your
configuration to reproduce the effect.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problems with ssh tab completion
  2006-10-10 15:47     ` Bart Schaefer
@ 2006-10-10 16:26       ` Stanislaw Halik
  0 siblings, 0 replies; 5+ messages in thread
From: Stanislaw Halik @ 2006-10-10 16:26 UTC (permalink / raw)
  To: zsh-users

On Tue, Oct 10, 2006, Bart Schaefer wrote:
> } However, both disabling this matcher-list completely and entering the
> } one you specified seems to have no effect. Hostnames, as previously,
> } are delimited with dots as "delimiters" of some sort.
> I'm out of ideas at the moment and don't have enough details of your
> configuration to reproduce the effect.

Parts of my zshrc having effects on the completion are located at
<http://tehran.lain.pl/x/completion> and <http://tehran.lain.pl/x/opts>.

Thanks in advance.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-10 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-09  2:37 problems with ssh tab completion Stanislaw Halik
2006-10-09 15:01 ` Bart Schaefer
2006-10-09 22:23   ` Stanislaw Halik
2006-10-10 15:47     ` Bart Schaefer
2006-10-10 16:26       ` Stanislaw Halik

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).