From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2898 invoked by alias); 25 Mar 2018 05:25:11 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23274 Received: (qmail 29102 invoked by uid 1010); 25 Mar 2018 05:25:11 -0000 X-Qmail-Scanner-Diagnostics: from forward105p.mail.yandex.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(77.88.28.108):SA:0(-2.6/5.0):. Processed in 2.622881 secs); 25 Mar 2018 05:25:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: mva@mva.name X-Qmail-Scanner-Mime-Attachments: |signature.asc| X-Qmail-Scanner-Zip-Files: | From: "Vadim A. Misbakh-Soloviov" To: zsh-users@zsh.org Subject: Re: ssh host completion Date: Sun, 25 Mar 2018 12:18:44 +0700 Message-ID: <3190684.aVAqXDk5dL@note> In-Reply-To: References: <25763.1521678403@thecus> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2183582.6tifytGjQF"; micalg="pgp-sha256"; protocol="application/pgp-signature" --nextPart2183582.6tifytGjQF Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" > Thanks, the first context suggestion worked. Just in case, here is what I use for hosts completion: zstyle -e ':completion:*:hosts' hosts 'reply=( ${${${${${(f)"$(cat ${HOME}/.ssh/known_hosts 2>/dev/null)"//\[/}//\]:/ }:#[\|]*}%%\ *}%%,*} ${${${(z)${(@M)${(f)"$(cat ${HOME}/.ssh/config 2>/dev/null)"}:#Host *} #Host }:#*[*?]*}} ${(s: :)${(ps:\t:)${${(f)~~"$(cat /etc/hosts 2>/dev/null)"}%%\#*} #*[[:blank:]]}} )' (I hope, you'll be able to restore lines after "78-col breakage") Also, it is possible to avoid using "cats" by using $(