Setting it up with compinstall

To set up auto-completion in ZSH, you can use the compinstall command. This will open a menu that allows you to configure auto-completion settings. To run compinstall, type the following:

compinstall

Debugging auto-completion

Let’s say you expect the ag command to allow for tab-completion, but when you type ag <TAB>, nothing happens. To debug this, you can output debugging details to a tmp file by typing the following:

ag <ctrl-x>?

That will dump debugging information to a file in /tmp/zsh* by running _complete_debug. You can then inspect the file to see what’s going on.

source: stackexchange user “Gilles”