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

Zsh completion fixes #1047

Merged
merged 3 commits into from
Dec 13, 2020
Merged

Zsh completion fixes #1047

merged 3 commits into from
Dec 13, 2020

Conversation

felipec
Copy link
Contributor

@felipec felipec commented Nov 3, 2020

There's a bunch of issues regarding the zsh completion:

  • The Zsh bash completion emulation was loaded at the wrong time
  • The Git bash completion helpers were not used correctly
  • The Zsh bash completion emulation can't be relied upon

These changes should fix the issues mentioned in pull #960 and #940.

We need to load bashcominit, otherwise complete() isn't available.

  __git_complete:5: command not found: complete

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
COMPREPLY and compgen aren't supposed to be used directly.

Also in order for the Git's zsh emulation to work correctly, _tig
shouldn't be exposed.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
We don't need all Zsh's bash completion emulation (which is buggy), it's
better to use Git's Zsh completion.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
@llua
Copy link

llua commented Nov 3, 2020

The intention e073f1b seems to be to use the completer for tig provided by zsh, if that is the case, then contrib/tig-completion.zsh doesn't need to exist since zsh 4.3.12 (2011). after loading compsys autoload -Uz compinit; compinit, it should do the right thing.

@felipec
Copy link
Contributor Author

felipec commented Nov 3, 2020

The intention e073f1b seems to be to use the completer for tig provided by zsh

No, not the one provided by Zsh, the one provided by Git:

https://git.kernel.org/pub/scm/git/git.git/tree/contrib/completion/git-completion.zsh

The one provided by Zsh would not load the tig bash completion function __tig_main, the one I wrote would.

@@ -33,8 +33,6 @@ __tig_options="
-v --version
-h --help
-C
--
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why did you reve these two lines? They are valid completion options :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because they confuse __gitcomp. Well, at least the -- one.

Most commands do have the -- option, but none that I'm aware of actually add it to the completion.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, then that sounds fine to me too.

Copy link
Collaborator

@koutcher koutcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A big thanks for looking into this issue (especially as my previous attempt in 2.5.1 did more bad than good).

@koutcher koutcher merged commit 04cc156 into jonas:master Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants