Separate path for .zcompdump files

zsh

I understand .zcompdump-* files are dumped configuration files that can speed up completion and that can be deleted safely. I would like to store them in a separate location since they clutter my home directory. What's a good way of doing so?

I know one option is to use the ZDOTDIR variable but that would force me to place all my zsh dot files in that location. I just want to store the .zcompdump files elsewhere.

Best Answer

In your .zshrc, change the invocation of compinit to add a -d option with the location of the file. For example:

compinit -d ~/.cache/zsh/zcompdump-$ZSH_VERSION
Related Question