From: Mikael Magnusson <mikachu@gmail.com>
To: "Vadim A. Misbakh-Soloviov" <mva@mva.name>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Ssh completion from ~/.ssh/config
Date: Tue, 7 Apr 2015 17:53:43 +0200 [thread overview]
Message-ID: <CAHYJk3R-8qUmkaSgvGOxUrhjEA-6oiDx+gagJABou7ZnW+Q1jw@mail.gmail.com> (raw)
In-Reply-To: <1797284.9M4pHoONQN@note>
On Tue, Apr 7, 2015 at 4:27 PM, Vadim A. Misbakh-Soloviov <mva@mva.name> wrote:
> ```
> # Hostnames completion.
> zstyle -e ':completion:*:hosts' hosts 'reply=(
> ${${${${${(f)"$(<${HOME}/.ssh/known_hosts)"//\[/}//\]:/ }:#[\|]*}%%\
> *}%%,*}
> ${${${(@M)${(f)"$(<${HOME}/.ssh/config)"}:#Host *}#Host }:#*[*?]*}
> ${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}#*[[:blank:]]}}
> )'
> zstyle ':completion:*:*:*:hosts' ignored-patterns 'ip6*' 'localhost*'
>
>
> ```
You'll probably want these lines inside an if test -f ~/.ssh/config,
as old versions of zsh will abort execution if $(< fails to find the
file. (This bit me once a few years ago).
--
Mikael Magnusson
next prev parent reply other threads:[~2015-04-07 15:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 13:14 Jesper Nygårds
2015-04-07 14:27 ` Vadim A. Misbakh-Soloviov
2015-04-07 15:53 ` Mikael Magnusson [this message]
2015-04-07 18:37 ` Jesper Nygårds
2015-04-08 7:24 ` shawn wilson
2015-04-08 16:47 ` Bart Schaefer
2015-04-08 17:59 ` Jesper Nygårds
2015-04-08 6:42 ` Artur Penttinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3R-8qUmkaSgvGOxUrhjEA-6oiDx+gagJABou7ZnW+Q1jw@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=mva@mva.name \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).