From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14694 invoked from network); 27 Mar 2006 13:47:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 27 Mar 2006 13:47:53 -0000 Received: (qmail 62939 invoked from network); 27 Mar 2006 13:47:45 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Mar 2006 13:47:45 -0000 Received: (qmail 5193 invoked by alias); 27 Mar 2006 13:47:38 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10095 Received: (qmail 5184 invoked from network); 27 Mar 2006 13:47:37 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 27 Mar 2006 13:47:37 -0000 Received: (qmail 61837 invoked from network); 27 Mar 2006 13:47:37 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 27 Mar 2006 13:47:36 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly23c.srv.mailcontrol.com (MailControl) with ESMTP id k2RDlY7R028791 for ; Mon, 27 Mar 2006 14:47:34 +0100 Received: from csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 27 Mar 2006 14:47:34 +0100 To: zsh-users@sunsite.dk Subject: Re: completion with descriptions In-reply-to: <20060327132750.GB27668@spiegl.de> References: <20060327132750.GB27668@spiegl.de> Comments: In-reply-to Andy Spiegl message dated "Mon, 27 Mar 2006 15:27:50 +0200." Date: Mon, 27 Mar 2006 14:46:22 +0100 From: Peter Stephenson Message-ID: X-OriginalArrivalTime: 27 Mar 2006 13:47:34.0001 (UTC) FILETIME=[001D4610:01C651A5] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-06-00-04 (www.mailcontrol.com) on 10.67.0.133 Andy Spiegl wrote: > How can I provide a description for every offered completion > like e.g. "kill" does it nicely? > > In my completion function I tried like this: > ':cmds: compadd ${${(f)"$(gigaset --commands)"}%%[[:space:]]##--*}' \ You need to use the _describe function; see the zshcompsys manual. There are examples of this buried in various places. You probably won't be able to do it inline; you need to create an array with elements containing both completions and descriptions separated by a colon. Here's a noddy example. _foo() { local -a d d=(foo:"The word foo" bar:"A rod") _describe "noddy example" d } compdef _foo foo -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php