Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: autocompletion with ssh and .ssh/config
- X-seq: zsh-workers 28087
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: autocompletion with ssh and .ssh/config
- Date: Sun, 18 Jul 2010 10:51:32 +0200
- Cc: David Duponchel <d.duponchel@xxxxxxxxx>, zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=LGSPY1zEIGwVmfNxl9KhZtcBZf5/SI6PvxPNvAKGFhQ=; b=vtBJts9WryYg6isnLitxNoNyCo+HdCi7PwF8igvDTLCdMZVtQTbOBlnP7jTld/zjAd baTG8e3HZNZCTbPi71RUdHQTSvI6XMQtEBm0513PDm5ozLHmdaPBiz1dWOm3zunUwlp0 ogzJ1K+tlrH7wBnD0N9Tyq+hfJfCM+K8JUE9s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=LAE7A86Ieqn+qD6YTQe04+fiHol6cq4tEnwciFZZsTCLehXZyT2+sZh4T6p3dmG0rq TxyGMJTXfdRIfgVJDuhWIPvDBMjy9U9ATteY2X6dx+R4xZVKhexswI1rwtsAywogrYaX 43t5/2SpelTzgUjY+rkgN89cwxbm4wUcHXyQY=
- In-reply-to: <alpine.LNX.2.01.1007180109520.14779@xxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <AANLkTikyZ8XZ_A8yGIQN2PRSXoA1Un6ZNdI6GLDzQpNN@xxxxxxxxxxxxxx> <alpine.LNX.2.01.1007180109520.14779@xxxxxxxxxxx>
On 18 July 2010 07:21, Benjamin R. Haskell <zsh@xxxxxxxxxx> wrote:
> On Sun, 18 Jul 2010, David Duponchel wrote:
>
>> Hi,
>>
>> I have some hosts defined in my .ssh/config file. Example :
>> Host bar
>> HostName 1.2.3.4
>>
>> Host baz
>> HostName 2.3.4.5
>>
>> When I type ssh <tab>, only my users and hosts in /etc/hosts are
>> displayed (my .ssh/config is ignored).
>> With ssh ba<tab> the autocompletion is correctly done and propose bar
>> and baz.
>> Same behavior with ssh user@<tab> and ssh user@ba<tab>
>>
>> Expected : Hosts from ssh/config are proposed by the autocompletion
>> with the other hosts.
>>
>> I did some research and the root of the problem seems to be in
>> Completion/Unix/Command/_ssh, function _ssh_hosts : the function
>> exists too early (before reading ssh/config).
>>
>>
>> Used .zshrc :
>> autoload -U compinit
>> compinit
>>
>> Tested env : zsh 4.3.10 and 4.3.10-dev-1, OS : Archlinux.
>>
>
> Confirmed with a pretty recent git build.
>
> Host from ~/.ssh/config aren't proposed until hosts found from other
> methods are exhausted. The biggest reason that seems wrong (IMO) is
> that 'other methods' includes ~/.ssh/known_hosts. So, a host I've never
> ssh'ed to won't be offered until I've ssh'ed to it.
>
> With 'acerwin.internal' and 'acerlin.internal' as hosts that show up
> already, I tested by adding, to an already large ~/.ssh/config:
>
> Host acerjjjconfig
>
> And editing ~/.ssh/known_hosts to add acerjjjkh as an alias of some
> other host.
>
> Then acerlin, acerwin, and acerjjjkh are offered in the initial list,
> but acerjjjconfig isn't offered until I type the 'c' (which is also
> annoying because acerj<Tab> completes at that point unambiguously to
> acerjjjkh).
>
> The two _combinations branches in _ssh_hosts that use the user-hosts tag
> seem to be returning intentionally if anything matches. Removing the '
> && return' from each seems to make things better. But, I'm not sure of
> the use-case that those are supporting.
>
> Another thing to note is that I couldn't get it to recognize HostName
> when HostName was indented as David had it. E.g. adding:
>
> Host acerjjjconfig
> HostName acerjjjindented
>
> only added acerjjjconfig to the list of completions.
Here's the commit that introduced the &&returns,
http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=7072c10ae223e24f601b3
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author