git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: jost.schulte@tutanota.com
Cc: Git <git@vger.kernel.org>
Subject: Re: Shell completion for branch names
Date: Wed, 07 Apr 2021 12:52:26 -0700	[thread overview]
Message-ID: <xmqqr1jlzxc5.fsf@gitster.g> (raw)
In-Reply-To: <MXghkzC----2@tutanota.com> (jost schulte's message of "Wed, 7 Apr 2021 16:23:16 +0200 (CEST)")

jost.schulte@tutanota.com writes:

> I have a question regarding git-completion. I'm using zsh and have
> added the function .git-completion.bash. That gives me some
> auto-completion for branch names.
>
> What I'm looking for: I have a branch named
> "feature/issue-123-add-feature" for example. I'd like to type "git
> switch 123[tab]". Is there some function out there that provides
> this?

I am not an area expert for shell completion, but as a mere user,
unless the shell completion in a directory where I have README.txt
file, responds to

    $ cat EAD<TAB>

and completes the request to

    $ cat README.txt

I would find such a behaviour quite confusing.

On the other hand if

    $ git log feat<TAB>

expands to

    $ git log feature/issue-

then another <TAB> after that would offer 123-add-feature and 143-fix
as candidates, or instead of <TAB> if I type "123<TAB>" and get it
expanded to the full feature/issue-123-add-feature, then I wouldn't
find it confusing or unnatural.

  reply	other threads:[~2021-04-07 19:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 14:23 jost.schulte
2021-04-07 19:52 ` Junio C Hamano [this message]
2021-04-07 20:00 ` Jeff King
2021-04-07 14:23 jost.schulte

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqr1jlzxc5.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jost.schulte@tutanota.com \
    --subject='Re: Shell completion for branch names' \
    /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

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).