Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: autocompletion with remote hosts
- X-seq: zsh-users 14678
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: "Mr.SpOOn" <mr.spoon21@xxxxxxxxx>
- Subject: Re: autocompletion with remote hosts
- Date: Mon, 21 Dec 2009 14:39:48 -0800
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d200912; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=ya2QMByQGoinfUQNZJGOsGKnigDUmp2WPL6D/luArww=; b=hKNgzEsqy4vEyWF9k2wCcH+945+a5nSSeupY9ljVrlhG8TCCLaHRjSOkKCR4DZ8kdaa2VwqPQEu7aKGRdtW10GHEaSmelBH5yoCJS1XZDyw1UrunrpbQyGVv9ZfKr6Yia9tnWsP6DKJ9oAO+0UFDgG9g3MvAM8tgqgMPAMdUaEo=;
- In-reply-to: <8f67b6f80912210936n62f8e4dbx3aee05da6164bb08@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: "Mr.SpOOn" <mr.spoon21@xxxxxxxxx>, zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <8f67b6f80912210936n62f8e4dbx3aee05da6164bb08@xxxxxxxxxxxxxx>
On 2009-12-21 at 18:36 +0100, Mr.SpOOn wrote:
> in bash I somehow managed to have autocompletion for remote hosts and
> directory when I used ssh and scp.
>
> I can't find a way to have the same in zsh.
> Can you help me?
It works out-of-the-box, once you activate the new completion system.
Hostnames can be specified by style, but if not overriden then:
* first hosts from the known_hosts files (system and user) are used
* if those are not matched by what's typed so far, hosts from "Host "
rules in the user ~/.ssh/config file are used
and you *really* want to either have ssh-agent running, with pubkey
authentication, or be using Kerberised SSH, to use this functionality.
Oh, and if you have "getent" installed, { getent hosts } is used; so in
an LDAP environment, this can cause tab-completion to get *really* slow
unless you override the hosts completion with zstyle.
The zsh completion calls ssh with { -o BatchMode=yes }, so you need to
be able to authenticate automatically. And of course you should have a
"clean" shell setup, so that nothing is emitted to stdout or stderr when
you ssh to a host to run a command non-interactively.
% ssh other-host true
If you see output from that command, fix your shell setup.
....% zsh -f
mybox% bindkey -e
mybox% autoload compinit
mybox% compinit
mybox% ssh <tab>
[ see users and hosts ]
mybox% ssh -l nobody <tab>
[ see hosts from ~/.ssh/known_hosts ]
mybox% ssh -l nobody co<tab>
[ get a completion I have in ~/.ssh/config which doesn't match a
known_hosts entry ]
You can control the completion with zstyle to set various tags; these
are documented in zshcompsys(1). 'users' and 'hosts' are the easiest.
Regards,
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author