From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Vadim Zeitlin <vz-zsh@zeitlins.org>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re[2]: How to set up completion for git aliases?
Date: Thu, 1 Nov 2012 00:46:24 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.01.1211010042520.24430@hp.internal> (raw)
In-Reply-To: <E1TTiE9-00078G-MY@smtp.tt-solutions.com>
On Thu, 1 Nov 2012, Vadim Zeitlin wrote:
> On Sat, 07 Jul 2012 01:02:43 +0200 Frank Terbeck <ft@bewatermyfriend.org> wrote:
>
> FT> Vadim Zeitlin wrote:
> FT> > I have a simple git alias "lg = log --oneline" and I'd like zsh to
> FT> > complete it in the same way as it already completes "git log".
> ...
> FT> You don't need to do anything, unless you're on a quite old version of
> FT> zsh. The _git completion has support for that out of the box.
>
> Hello,
>
> I'd like to return to this thread because I think that this (very
> useful) feature doesn't play well with the method of setting up custom
> completion for git subcommands described in the standard
> Completion/Unix/_git: the comment in the beginning of this file says
> that you should be able to simply defined your own _git-foo completion
> function to handle completion of "git foo". Unfortunately this doesn't
> seem to work or, actually, it does work as long as "foo" is really an
> external command and not an alias. But if I have "foo" defined as an
> alias in my ~/.gitconfig, then it seems that the alias completion
> takes over and it tries to complete the "!sh -c ..." alias expansion
> which, unsurprisingly, doesn't work really well.
>
> Is there some way to tell git completion to use _git-foo if it's
> defined even if foo is an alias? I tried to find it but unfortunately
> _git file is just too much for me...
>
> Of course, there is always the solution of actually using an external
> command instead of an alias but having an alias is often more
> convenient for simple one-liners so it would be nice if it could be
> made to work.
I recently posted a patch to make this work:
zsh-workers 30737
http://www.zsh.org/mla/workers/2012/msg00643.html
For the example mentioned (git alias "lg = log --oneline"), if the
function _git-lg exists, the patch will let it be used for completion.
--
Best,
Ben
prev parent reply other threads:[~2012-11-01 4:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 17:04 Vadim Zeitlin
2012-07-06 17:56 ` Axel Beckert
2012-07-06 23:02 ` Frank Terbeck
2012-07-07 0:52 ` Re[2]: " Vadim Zeitlin
2012-07-17 19:20 ` Axel Beckert
2012-07-17 19:54 ` Frank Terbeck
2012-11-01 0:01 ` Re[2]: " Vadim Zeitlin
2012-11-01 4:46 ` Benjamin R. Haskell [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=alpine.LNX.2.01.1211010042520.24430@hp.internal \
--to=zsh@benizi.com \
--cc=vz-zsh@zeitlins.org \
--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).