zsh-users
 help / color / mirror / code / Atom feed
From: Conrad Irwin <conrad.irwin@gmail.com>
To: zsh-users@zsh.org
Subject: Re: _git Completion and custom commands
Date: Tue, 28 Sep 2010 19:01:49 +0100	[thread overview]
Message-ID: <AANLkTimpBLG0mfPtJ8MO0Bitja0mSb2UW0roXh4N-wbN@mail.gmail.com> (raw)
In-Reply-To: <20100928080340.GJ9720@fsst.voodoo.lan>

On 28 September 2010 09:03, Frank Terbeck <ft@bewatermyfriend.org> wrote:
> Benjamin R. Haskell <zsh@benizi.com>:
> [...]
>>> The one issue I've found is that the _git completion function (as of
>>> 4.3.10 shipped with Debian testing) does not include custom commands
>>> (though it does include aliases).
> [...]
>> zstyle ':completion:*:git:*' user-commands ${${(k)commands[(I)git-*]}#git-}
>

This is perfect — thank you!

> Yes, this is explained at the top of the _git completion file.
>

On some version later than the version I used to have. Thank you for
your help (on IRC) in getting the right version of the _git function,
which allowed Ben's command to work.

> Now, if you want smartness, when you try `git foo <tab>' you may
> write a function `_git-foo()' and _git will pick it up. So, if
> your `git-foo' program supports a few options (-f, -v and -q), a
> completion function may look like this:
>
> The `style' line Benjamin gave sets the `user-commands' style to a
> list of all `git-*' commands zsh finds in $PATH. It's useful if you
> got a *lot* of own scripts. Since zsh cannot guess a description for
> the programs this way, commands added like that will be missing
> descriptions.

I do have a large number of commands, but luckily I know what they do
:). So I'm going with the automagic rather than the explicit — though
I may consider the additional options for the few commands that take
several options (particularly those that mix the arguments of other
git commands)

> PS: If the OP didn't configure compsys yet, then
>    <http://zshwiki.org/home/examples/compquickstart> may serve him
>    as a quickstart. I'll certainly help to get menus such as the
>    ones I mentioned above.
>
I was just comparing this to the default that Debian gave me — I'll
have to investigate further.

Thanks to everyone.

Conrad


      reply	other threads:[~2010-09-28 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28  0:29 Conrad Irwin
2010-09-28  4:06 ` Benjamin R. Haskell
2010-09-28  5:28   ` Sebastian Stark
2010-09-28  6:30     ` Benjamin R. Haskell
2010-09-28  8:03   ` Frank Terbeck
2010-09-28 18:01     ` Conrad Irwin [this message]

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=AANLkTimpBLG0mfPtJ8MO0Bitja0mSb2UW0roXh4N-wbN@mail.gmail.com \
    --to=conrad.irwin@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).