From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4580 invoked by alias); 12 Aug 2010 09:56:19 -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: 15265 Received: (qmail 24802 invoked from network); 12 Aug 2010 09:56:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Thu, 12 Aug 2010 10:56:08 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: Completion on simple commande Message-ID: <20100812105608.5f7bf1ec@csr.com> In-Reply-To: References: Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 12 Aug 2010 09:56:08.0673 (UTC) FILETIME=[96569D10:01CB3A04] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.68.0.112 On Thu, 12 Aug 2010 11:11:11 +0200 Michel wrote: > I use an zsh function to launch the graphical application. But I don't > know how have the completion on my function. > > My function is : > function start (){ > $@ > /dev/null 2> /dev/null & > } > > And I want can type : > start fire "man zshcompsys" is the place to start, but working that way it'll take a while before you get to the point where you can answer questions like this. First you'll need to start the completion system; it's not clear if you've done that. If you haven't, put this in your ~/.zshrc: autoload -Uz compinit compinit Then the simplest answer to the immediate question is to add the following line: compdef _precommand start That makes "start" behave like other command words that take a complete command line following. By the way, you might want to put the $@ in double quotes: function start (){ "$@" > /dev/null 2> /dev/null & } The difference is that this won't remove any zero-length arguments to the command, e.g. a '' on the command line. That's not a typical problem with the sort of use you have, however. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom