zsh-users
 help / color / mirror / code / Atom feed
From: Michel <michel.barret@gmail.com>
To: zsh-users@zsh.org
Subject: Re: Completion on simple commande
Date: Thu, 12 Aug 2010 13:24:14 +0200	[thread overview]
Message-ID: <AANLkTimdzSe_LgY65nmQ4bL3a0M2by=5_LhPBNORWucX@mail.gmail.com> (raw)
In-Reply-To: <20100812105608.5f7bf1ec@csr.com>

2010/8/12 Peter Stephenson <Peter.Stephenson@csr.com>:
> On Thu, 12 Aug 2010 11:11:11 +0200
> Michel <michel.barret@gmail.com> 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<tab>
>
> "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

This configuration is already applied.

> Then the simplest answer to the immediate question is to add the following
> 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 (){
>    "$@" > /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.

Ok I make this modification thanks you and Frank Terbeck.


  reply	other threads:[~2010-08-12 11:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12  9:11 Michel
2010-08-12  9:56 ` Peter Stephenson
2010-08-12 11:24   ` Michel [this message]
2010-08-12  9:56 ` Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimdzSe_LgY65nmQ4bL3a0M2by=5_LhPBNORWucX@mail.gmail.com' \
    --to=michel.barret@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).