mattmc3 / ez-compinit

🐣 - Make Zsh compinit suck less
MIT License
10 stars 1 forks source link

~/.config/zsh/.zcompdump is always created #4

Open pwyde opened 5 days ago

pwyde commented 5 days ago

Hi!

I am in the process of switching my Zsh setup from zinnit to antidote and want to use ez-compinit to manage my completions. I am not sure if this is a antidote or ez-compinit issue. Please let me know if this issue belongs somewhere else.

Here are my configuration files which is still a work in progress.

~/.config/zsh/.zshenv

# Make Zsh respect XDG directories.
export ZDOTDIR=${ZDOTDIR:-$HOME/.config/zsh}

# Set XDG base directories.
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
export XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
# XDG base directories not in specification.
export XDG_BIN_HOME=${XDG_BIN_HOME:-$HOME/.local/bin}

# Fish-like directories.
: ${__zsh_config_dir:=${ZDOTDIR:-${XDG_CONFIG_HOME:-$HOME/.config}/zsh}}
: ${__zsh_user_data_dir:=${XDG_DATA_HOME:-$HOME/.local/share}/zsh}
: ${__zsh_cache_dir:=${XDG_CACHE_HOME:-$HOME/.cache}/zsh}

# Ensure XDG/Zsh directories exist.
() {
    local dir
    for dir in "$@"; do
        [[ -d "${(P)dir}" ]] || mkdir -p -- "${(P)dir}"
    done
} __zsh_{config,user_data,cache}_dir XDG_{CONFIG,CACHE,DATA,STATE,BIN}_HOME

~/.config/zsh/.zshrc

#
# Antidote: Zsh plugin manager.
#

export ANTIDOTE_REPO=${XDG_DATA_HOME:-$HOME/.local/share}/antidote
[[ -d $ANTIDOTE_REPO ]] \
    || git clone --depth 1 https://github.com/mattmc3/antidote $ANTIDOTE_REPO

bundle_file=${ZDOTDIR:-$HOME/.config/zsh}/zsh_plugins
static_file=${XDG_DATA_HOME:-$HOME/.local/share}/zsh/zsh_plugins.zsh
[[ -f $bundle_file ]] || touch $bundle_file

# Source Antidote.
source $ANTIDOTE_REPO/antidote.zsh

# Use friendly names with the bundle directory in $ANTIDOTE_HOME.
zstyle ':antidote:bundle' use-friendly-names    on
# Set custom bundle file. Default: ${ZDOTDIR:-$HOME}/.zsh_plugins
zstyle ':antidote:bundle' file                  $bundle_file
# Set custom static file. Default: ${ZDOTDIR:-$HOME}/.zsh_plugins.zsh
zstyle ':antidote:static' file                  $static_file
# Zsh compile everything, static file and all bundles.
zstyle ':antidote:*'      zcompile              yes

#
# Completions: Set completion options.
#

zstyle ':plugin:ez-compinit' 'compstyle' 'zshzoo'

#
# Plugin settings: Set options for various plugins.
#

export FZF_PATH=${XDG_DATA_HOME:-$HOME/.local/share}/fzf

#
# Wrap-up
#

# Initialize plugins statically with ${ZDOTDIR:-$HOME/.config/zsh}/zsh_plugins file.
# Note: Must be loaded after setting zstyles.
antidote load

~/.config/zsh/zsh_plugins

#
# Completions
#
mattmc3/ez-compinit
zsh-users/zsh-completions kind:fpath path:src

#
# Utilities
#
mattmc3/zephyr path:plugins/color
mattmc3/zephyr path:plugins/directory
mattmc3/zephyr path:plugins/history
ohmyzsh/ohmyzsh path:plugins/command-not-found
ohmyzsh/ohmyzsh path:plugins/extract

#
# FZF
#
unixorn/fzf-zsh-plugin
Aloxaf/fzf-tab

#
# Fish-like plugins
#
mattmc3/zephyr path:plugins/zfunctions
mattmc3/zephyr path:plugins/confd
zdharma-continuum/fast-syntax-highlighting
zsh-users/zsh-autosuggestions
zsh-users/zsh-history-substring-search

The issue is that no matter what I do the ~/.config/zsh/.zcompdump file is always created and before ez-compinit creates ~/.cache/zsh/zcompdump. Basically I end up with two zcompdump files in different locations and which one is Zsh actually using?

Isn't ez-compinit supposed to manage my zcompdump file and set it to a static location? Any suggestions what I am doing wrong would be very appreciated. Or am I using ez-compinit incorrectly?

Many thanks and keep up the good work! :smile:

mattmc3 commented 1 day ago

@pwyde - I put the config you shared in a demo repo to see if I could reproduce your issue, but cannot. The only thing I can think of is you have something in $ZDOTDIR/.conf.d that you haven't shared (since you use the mattmc3/zephyr path:plugins/confd plugin). Is there any part of your config you haven't shared?

pwyde commented 9 hours ago

$ZDOTDIR/.conf.d is empty. The only thing I forgot to mention is that I have the following in /etc/zsh/zshenv:

export ZDOTDIR="${HOME}/.config/zsh"

This is so I can actually have all my Zsh configuration files in ~/.config/zsh directory. Otherwise my Ubuntu 24.04 system assumes .zshrc and .zshenv should exist directly in my $HOME directory.

Here is a more or less empty $HOME with the Zsh configuration files specified in the original post:

ubuntu-server% tree -a -I '.vscodium-server' $HOME
/home/patrik
β”œβ”€β”€ .cache
β”‚Β Β  └── Microsoft
β”‚Β Β      └── DeveloperTools
β”‚Β Β          └── deviceid
β”œβ”€β”€ .config
β”‚Β Β  └── zsh
β”‚Β Β    Β Β  β”œβ”€β”€ conf.d
β”‚Β Β    Β Β  β”œβ”€β”€ .zshenv
β”‚Β Β    Β Β  β”œβ”€β”€ zsh_plugins
β”‚Β Β    Β Β  └── .zshrc
β”œβ”€β”€ .local
β”‚Β Β  β”œβ”€β”€ bin
β”‚Β Β  β”œβ”€β”€ share
β”‚Β Β  └── state
└── .ssh
    └── authorized_keys

And now I start a new Zsh shell and check what has been created:

ubuntu-server% zsh
Cloning into '/home/patrik/.local/share/antidote'...
remote: Enumerating objects: 207, done.
remote: Counting objects: 100% (207/207), done.
remote: Compressing objects: 100% (171/171), done.
remote: Total 207 (delta 14), reused 123 (delta 4), pack-reused 0 (from 0)
Receiving objects: 100% (207/207), 71.40 KiB | 1.52 MiB/s, done.
Resolving deltas: 100% (14/14), done.
# antidote cloning mattmc3/ez-compinit...
# antidote cloning ohmyzsh/ohmyzsh...
# antidote cloning mattmc3/zephyr...
# antidote cloning zsh-users/zsh-history-substring-search...
# antidote cloning zdharma-continuum/fast-syntax-highlighting...
# antidote cloning Aloxaf/fzf-tab...
# antidote cloning unixorn/fzf-zsh-plugin...
# antidote cloning zsh-users/zsh-completions...
# antidote cloning zsh-users/zsh-autosuggestions...
Cloning into '/home/patrik/.local/share/fzf'...
remote: Enumerating objects: 131, done.
remote: Counting objects: 100% (131/131), done.
remote: Compressing objects: 100% (122/122), done.
remote: Total 131 (delta 5), reused 38 (delta 3), pack-reused 0 (from 0)
Receiving objects: 100% (131/131), 315.83 KiB | 1.90 MiB/s, done.
Resolving deltas: 100% (5/5), done.
Downloading bin/fzf ...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1523k  100 1523k    0     0  1441k      0  0:00:01  0:00:01 --:--:-- 1441k
- Checking fzf executable ... 0.56.3
Can't find a fzf configuration file at /home/patrik/.local/share/fzf/fzf.zsh, creating a default one
ubuntu-server% tree -a .config/zsh
.config/zsh
β”œβ”€β”€ conf.d
β”œβ”€β”€ .zcompdump
β”œβ”€β”€ .zshenv
β”œβ”€β”€ zsh_plugins
└── .zshrc

2 directories, 4 files
ubuntu-server% tree -a .cache/zsh
.cache/zsh
β”œβ”€β”€ zcompdump
└── zcompdump.zwc

1 directory, 2 files
ubuntu-server% rm .config/zsh/.zcompdump
ubuntu-server% zsh
ubuntu-server% tree -a .config/zsh
.config/zsh
β”œβ”€β”€ conf.d
β”œβ”€β”€ .zcompdump
β”œβ”€β”€ .zshenv
β”œβ”€β”€ zsh_plugins
└── .zshrc

2 directories, 4 files

As you can see, the ~/.config/zsh/.zcompdump is constantly re-created. Could this behaviour be a Ubuntu specific thing?