From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7618 invoked by alias); 5 Nov 2016 17:24:31 -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: X-Seq: 22086 Received: (qmail 9588 invoked from network); 5 Nov 2016 17:24:31 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f49.google.com 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(209.85.213.49):SA:0(0.0/5.0):. Processed in 0.77865 secs); 05 Nov 2016 17:24:31 -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=0.0 required=5.0 tests=SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.213.49 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=WpXORmeb3tx7pj0hp5wHTMJby+ZUpGOs+kJh7/oW97U=; b=Vm4oXvzXx+lrJ5USmB29yljgNY2m1P0Dnqa+nE9PbJpv51+dZZxaaGTAVUqQ5NYVu4 CtJ1uzMb9dKx6maXmt/sbf29M3UwzeKiNiPYaXagGIzWnv4DE+MfTLOZ3NF6Uq5ooIUq kO2/AYzsZf7e3FsM+9YK27bqXooas87VIAhOma/Kzqh8nLOUhbhfOAI4LB3m7fEysCxT zFZJjcipfgzM3F3WqmjcZN+7wHvoObakrjyZ+z1+TWGG04peoNwol57CeKd4pMJP+3bG iks0KaG1EILqE5W1qK2Ex9yLT6BVUhiqybuC+pv8qwl4roAooeJH/AJ4zWJe/AU2CuNV CeXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=WpXORmeb3tx7pj0hp5wHTMJby+ZUpGOs+kJh7/oW97U=; b=V/RUb6DfXS8yR6cIlNqsh5N4E8FkrORp8jDrOvM/AXifK2d1m7o0CWZTSUVi761GaW EEqCpUc5p0Pvx5zAvIGpQWM/LmEjeyjexHzxOjxR11M9SfWm4xnmAk7Hda8lHDBYgi7P U/UxrlGua898T3nYxkq/jMyzNMylP6omtpzYavCAWrsozAY2laCEjnRnBbw9HmdA04Lz gcp/d0GNDkbYCx7CkDPIeobjUwuQYGVToty4Jiv4AqLWctuCin1cvUz+2vkkCtAlfYfo bUaP5H6ox/dzjMtWXHDZxh7tq+z8LJEmK7KnGc+cf58vo7vBjenwM3sZuGYFJI7/GB0Y O8Pg== X-Gm-Message-State: ABUngvfJFXFUPqos2zDTra4Uqxv2hlYiHvRu7M/k+fjMWgSEGHhlH8koF3VjFzkKkiIbNA== X-Received: by 10.31.189.14 with SMTP id n14mr13166144vkf.81.1478366664657; Sat, 05 Nov 2016 10:24:24 -0700 (PDT) From: Bart Schaefer Message-Id: <161105102455.ZM20692@torch.brasslantern.com> Date: Sat, 5 Nov 2016 10:24:55 -0700 In-Reply-To: <581D9E98.1000008@gmx.ch> Comments: In reply to Fourhundred Thecat <400thecat@gmx.ch> "Re: hostname completion for ssh / scp" (Nov 5, 9:55am) References: <581B8BCE.2040108@gmx.ch> <161104214237.ZM18518@torch.brasslantern.com> <581D9E98.1000008@gmx.ch> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: hostname completion for ssh / scp MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 5, 9:55am, Fourhundred Thecat wrote: } } I believe, getent hosts only returns hosts which have ip address } specified in /etc/hosts Well, yes. The syntax of the /etc/hosts file is first an IP and then a hostname. Somebody will possibly correct me, but I don't recall any valid use of /etc/hosts that has lines of host names without IPs. } > If getent isn't returning anything useful, you can replace it: } > } > zstyle ':completion:*:hosts' command 'cat /etc/hosts' } } I would like to keep the completion from ~/.ssh/config and add } completion from /etc/hosts. This shouldn't change the behavior with respect to ~/.ssh/config because that's read in _ssh_hosts rather than in _hosts where the style above applies. _hosts reads ~/.ssh/known_hosts whether or not the program named by the command style returns anything. However, ~/.ssh/config will be skipped if the users-hosts tag finds any matching hosts, which is likely to happen if you are starting from a blank word, because users-hosts calls _hosts which will look in known_hosts. If you start with a prefix on the line that matches a host in ~/.ssh/config and does NOT match one in ~/.ssh/known_hosts, you should get a completion. } > Note there have been several other fixes/improvements to ssh host-gathering } > since zsh 5.0. } } can I simply copy Unix/_ssh from zsh 5.0. and use it on zsh 4.3.17 ? I don't think so (you'd need at least _hosts as well) but in any case it wouldn't change anything because even 5.0+ is not expecting you to have just dumped a bunch of bare host names into /etc/hosts like that.