From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15795 invoked from network); 21 Jan 2005 10:46:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Jan 2005 10:46:59 -0000 Received: (qmail 8743 invoked from network); 21 Jan 2005 10:46:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Jan 2005 10:46:53 -0000 Received: (qmail 18471 invoked by alias); 21 Jan 2005 10:46:38 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8406 Received: (qmail 18458 invoked from network); 21 Jan 2005 10:46:37 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 21 Jan 2005 10:46:37 -0000 Received: (qmail 7627 invoked from network); 21 Jan 2005 10:46:37 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 21 Jan 2005 10:46:34 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Fri, 21 Jan 2005 10:45:12 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 21 Jan 2005 10:49:10 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j0LAkXgg007502 for ; Fri, 21 Jan 2005 10:46:33 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j0LAkWuO007499 for ; Fri, 21 Jan 2005 10:46:32 GMT Message-Id: <200501211046.j0LAkWuO007499@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-users@sunsite.dk Subject: Re: completing file names In-reply-to: <20050121092926.GD19548@vandal.simcon-mt.de> References: <20050121092926.GD19548@vandal.simcon-mt.de> Date: Fri, 21 Jan 2005 10:46:32 +0000 From: Peter Stephenson X-OriginalArrivalTime: 21 Jan 2005 10:49:10.0562 (UTC) FILETIME=[D6BD9820:01C4FFA6] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-1.7 required=6.0 tests=AWL,BAYES_00,URIBL_SBL autolearn=no version=3.0.2 X-Spam-Hits: -1.7 "Andrei A. Voropaev" wrote: > Completion is very good, but very complex to quickly understand it :) So > far I've configured everything as compinstall was guiding and I'm > satisfied. Only one thing bothers me. I would like to get the list of > hosts not from /etc/hosts file but from some other file. Because then I > can rely on DNS to find the appropriate IP for given file name. And > names I can collect say in ~/.known_hosts one host per line. How can I > set it up? You need to set the "hosts" style to the list of values in the file. zstyle ':completion:*' hosts $(<~/.known_hosts) should be good enough (host names don't need special quoting). > (in fact ~/.ssh/known_hosts can be such file, but there the host name is > followed by lots of things on the line :) You can do that, too: zstyle ':completion:*' hosts ${${(f)"$(<~/.ssh/known_hosts)"}%%[[:space:],]*} This is using zsh's CompletelyImpenetrableExpansionSystem (TM): "$(<~/.ssh/known_hosts)" produces the contents of the file as a single string. ${(f)...} splits that into an array of strings, one for each line of the file. ${...%%[[:space:],]*} for each element of the array, strips off everything from the first space or comma on, leaving the initial hostname in each case. (My ~/.ssh/known_hosts has IP addresses after a comma, which we don't want.) -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************