Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Should I add .zcompcache to '.gitignore'?

> On Jul 11, 2020, at 12:21 AM, dana <dana@xxxxxxx> wrote:
> On 10 Jul 2020, at 08:52, TJ Luoma <luomat@xxxxxxxxx> wrote:
>> Today the file `.zcompcache` appeared in it. Reading up on it, it
>> seems like a file that I would not want to save in my repo. Is that
>> correct?
> I can't think of any reason you would want to keep it in your repo. I have it
> ignored in mine

When I first got started with zsh, I also started with a newer version
of emacs which uses the new “XDG” base directory spec[1]

I don’t claim to have understood it but I tried.

Part of the spec is XDG_CACHE_HOME: $XDG_CACHE_HOME defines the base
directory relative to which user specific non-essential data files
should be stored. If $XDG_CACHE_HOME is either not set or empty, a
default equal to $HOME/.cache should be used.

In /etc/zshenv I have:

    if [[ -z "$XDG_CONFIG_HOME" ]]
            export XDG_CONFIG_HOME="$HOME/.config"

    if [[ -z "$XDG_CACHE_HOME" ]]
            export XDG_CACHE_HOME="$HOME/.cache"

    if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
            export ZDOTDIR="$XDG_CONFIG_HOME/zsh"

Then in various ~/.config/zsh/ files I have:

    zstyle ':completion::complete:*' cache-path "${ZCACHEDIR}/zcompcache"

The objectivie (which I may not have 100% succeeded at) is to keep all
of the temp / cache type files over in ~/.cache rather than ~/.config

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>

Messages sorted by: Reverse Date, Date, Thread, Author