linuxubuntuzshoh-my-zshzsh-completion

Where to place zsh autocompletion script on Linux?


After installing cheat (command cheat sheets from the command line), I tried to enable the autocompletion using the provided zsh script. However, I don't seem to find the correct location for the script.

So far

Auto-completion doesn't happen when typing cheat d<TAB>.

Question

So where to place zsh auto-completion script on Linux?


Solution

  • I got this to work by adding cheat.zsh to the ~/.oh-my-zsh/plugins directory. Zsh checks to autoload functions on FPATH, so try:

    echo $FPATH
    

    and then either add to FPATH or move the file into a folder on the path.

    This actually does a much better job of explaining it: https://unix.stackexchange.com/questions/33255/how-to-define-and-load-your-own-shell-function-in-zsh