The Wayback Machine - https://web.archive.org/web/20200521033743/https://github.com/github/hub/issues/1956
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: add docs for zsh completions #1956

Open
OliverJAsh opened this issue Nov 30, 2018 · 2 comments
Open

Suggestion: add docs for zsh completions #1956

OliverJAsh opened this issue Nov 30, 2018 · 2 comments
Labels

Comments

@OliverJAsh
Copy link
Contributor

@OliverJAsh OliverJAsh commented Nov 30, 2018

Out of the box, Zsh completions don't work as you would expect.

Given a fresh install:

brew install zsh
brew install git
brew install hub

# Workaround to fix bug with hub completions.
# hub completions only work when this alias is set.
# https://github.com/github/hub/issues/1792#issuecomment-403413131
alias git=hub

When I type git pull-<tab>, it successfully completes to git pull-request.

However, completion does not work for subcommand arguments. For example, when I type git pull-request -<tab>, the arguments do not complete.

After some digging, I discovered that I had two sets of Zsh completions for Git (using the setup above, which I believe is the route most people will take):

  • Git's official completions (e.g. /usr/local/share/zsh/site-functions/_git)
  • Zsh's official Git completions (e.g. /usr/local/Cellar/zsh/5.6.2_1/share/zsh/functions/_git)

Both of these were on my $fpath.

I then discovered that the author of the Hub Zsh completions seems to advise the usage of Zsh's official Git completions, rather than Git's official completions: #295 (comment)

I removed Git's official completions with rm /usr/local/share/zsh/site-functions/_git and then Hub Zsh completions seemed to work as expected. That is, when I type git pull-request -<tab>, arguments do complete.

I would like to suggest that we clearly document this caveat—Hub Zsh completions only seem to fully work when using Zsh's official Git completions, rather than Git's official completions—along with instructions for how to use Zsh's official Git completions instead.

/cc @goodell

@mislav
Copy link
Member

@mislav mislav commented Nov 30, 2018

Thank you for reporting! Due to the nature of hub extending git, our completions (both zsh and bash) might be a bit of a mess at the moment, and your research helps greatly.

@OliverJAsh
Copy link
Contributor Author

@OliverJAsh OliverJAsh commented Dec 6, 2018

I created a PR to improve the docs: #1962

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
@mislav @OliverJAsh and others
You can’t perform that action at this time.