From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19538 invoked by alias); 12 Aug 2010 11:24: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: 15270 Received: (qmail 7317 invoked from network); 12 Aug 2010 11:24:18 -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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.216.178 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=kix7N0qzFdZT51oPpwUSTtx+Qv5L/5oHtTFRsqVVGcc=; b=Jw6Y0epz9ddGFHpt9qynurQvUWtviUp0gerSqQ4J/HCpoOyvtCJjKD0iypfaKtmsbD FkvGwMKTEd1ARn0jzIfwvKARJLRdWLIUZKDqaSE/oc7bCy2GdiWcLvQra/bEOxzuA1hT mkVZ2yC9eF3LK0i+YYPCgjoDylEkItcU5SCd4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=nOr6kX+XyTBe230Kk/9lYFgc5ktB9reXIUDxTc4l0lXOb1Qi/LqCR9t1IRo48PVoYU 52Q4GfJCVfOlWaXFKKsRYItRuEGQn8C08B92V/BFWlptGYc/EZHIaLQyP4GiuAambeqJ zZGtKoknAKmXCmPW/TqJ5qnv7jVY4b348Ebi4= MIME-Version: 1.0 In-Reply-To: <20100812105608.5f7bf1ec@csr.com> References: <20100812105608.5f7bf1ec@csr.com> Date: Thu, 12 Aug 2010 13:24:14 +0200 Message-ID: Subject: Re: Completion on simple commande From: Michel To: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2010/8/12 Peter Stephenson : > 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 (){ >> =C2=A0 =C2=A0 $@ > /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 thi= s. > > First you'll need to start the completion system; it's not clear if you'v= e done > that. =C2=A0If you haven't, put this in your ~/.zshrc: > > autoload -Uz compinit > compinit This configuration is already applied. > Then the simplest answer to the immediate question is to add the followin= g > line: > > compdef _precommand start Thanks it's exactly that ! > 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 (){ > =C2=A0 =C2=A0"$@" > /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. =C2=A0That's not a typical proble= m with > the sort of use you have, however. Ok I make this modification thanks you and Frank Terbeck.