-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
Problem
Zsh completions for git gtr don't work out of the box following the README instructions.
The _git-gtr completion file contains a zstyle line to register gtr as a git subcommand:
zstyle ':completion:*:*:git:*' user-commands gtr:'Git worktree management'However, this line only executes when the completion function is autoloaded — which happens after zsh tries to complete git gtr. Git's completion system needs to know about gtr as a valid subcommand before triggering completion, creating a chicken-and-egg problem.
Steps to Reproduce
- Follow README instructions for Zsh:
mkdir -p ~/.zsh/completions cp completions/_git-gtr ~/.zsh/completions/ # Add to ~/.zshrc: fpath=(~/.zsh/completions $fpath)
- Reload shell:
source ~/.zshrc - Try
git gtr <TAB> - No completions appear
Workaround
Add the zstyle line directly to ~/.zshrc:
zstyle ':completion:*:*:git:*' user-commands gtr:'Git worktree management'Possible Solutions
- Update README — document that users must add the zstyle line to their
.zshrc - Create init snippet — separate file users source at shell init (not autoloaded)
- Oh My Zsh plugin — create a proper plugin structure that handles init
- Different registration approach — investigate if there's a way to register git subcommands that works with autoload
Looking for guidance on preferred approach before submitting a PR.
kubode
Metadata
Metadata
Assignees
Labels
No labels