Adding an autocompletion script to ZSH seems not to be working

474 views Asked by At

I have a Git repository, omni.

omni is checked out at ~/omni.

There is a completion script at ~/omni/completions/_omni.

I set fpath=( ~/omni/completions $fpath ), via ~/.zprofile so the completion script should get picked up but is not. This is trivially proven:

$ for dir in "$fpath[@]"; do if [ -f "$dir/_omni" ]; then echo $dir; fi; done
/Users/myusername/omni/completions

I have also run compinit -i to initialize completion, but the script does not get picked up.

$ compinit -i

$ which _omni
_omni not found

However, if I re-initialize the completion, everything works

$ which _omni
_omni not found

$ compinit -i

$ which _omni
_omni not found

$ compinit -u

$ which _omni
_omni () {
    # undefined
    builtin autoload -XUz
}

Now the completion script gets picked up.

What do I need to do so that the completion script gets picked up automatically when the shell starts, when compinit -i runs?

1

There are 1 answers

0
Zach Riggle On

This appears to have been something to do with permissions, as all of the files (and their parent directories) were marked 777.

chmod -R go-rwx ~/omni

Seems to have resolved the issue.