I have a few aliases that I want to autocomplete for git, e.g., the following
alias gco="git checkout"
When I was attempting to add completions for this alias, I looked around in my path and saw that a bunch of git completions were available (e.g.,
_git-diff-files). AndI used
compdef to define it:
compdef _git-checkout gco
This worked for a while, then I restarted my terminal and suddenly they were all gone... (getting an error about completions not available):
gco (eval):1: command not found: _git-checkout (eval):1: command not found: _git-checkout (eval):1: command not found: _git-checkout
The weird part is that they all get dumped into my path after I run
git reflog. (and then they work). Am I relying on some internal functions here that I shouldn't be? Should I go about this differently? (I could also just add a
git reflog into my
.zshrc, but that seems totally ridiculous to do).