After struggling to get tab completion for git setup on osx, I've gotten some odd errors that I can't find the source too.
zsh:12: command not found: ___main
_default:compcall:12: can only be called from completion function
I'm not sure what is causing the error as everything is setup correctly.
zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
autoload -U compinit && compinit
zmodload -i zsh/complist
source ~/.git-completion.zsh
Any ideas?
It seems that the git-completion.zsh
is not designed to be source
ed. You could copy the git-completion.zsh
file to somewhere in the $fpath
and rename it to _git
instead.
For example: (if you decide to have ~/.zsh/functions/_git
.)
First, you could copy the git-completion.zsh
to there and rename it to _git
.
% mkdir -p ~/.zsh/functions && cp git-completion.zsh ~/.zsh/functions/_git
Then you could have your ~/.zshrc
like this:
zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
# `compinit` scans $fpath, so do this before calling it.
fpath=(~/.zsh/functions $fpath)
autoload -Uz compinit && compinit
If I'm not sure, I do rm ~/.zcompdump
to make sure that compinit
discards its cache.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With