Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: git push completion

On Mon, 30 Jun 2014 12:01:40 +0200
Sebastian Stark <seb-zsh@xxxxxxxxxxx> wrote:
> if I autocomplete on "git push <tab>" it will give me like hundreds of
> hosts (I guess it's the generic _hosts completion) along with my
> configured remotes.
> How can I tell the completion system to only offer the configured
> remotes, I never push to other servers.

There's a recipe for this sort of thing.

- Type ^xh where you'd usually complete.

- Look at the output and decide which is the completion you really want
to see.  Here the answer appears to be

tags in context :completion::complete:git-push:argument-1:
    remotes                                         (__git_remotes _alternative __git_any_repositories _arguments _git-push _call_function _git) 

- You need to set a tag-order style for this context that puts that
tag, "remotes", first.

zstyle ':completion:*:git-push:*' tag-order remotes '*'

- Now you find that all though that makes a difference it doesn't
actually quite do what you were expecting --- in fact, the only thing it
seems to get rid of in my case is local respositories, leaving commit
tags and hosts.  You then wait for someone to work out why.  We're now
at this stage :-).


Messages sorted by: Reverse Date, Date, Thread, Author