Closed amitds1997 closed 2 months ago
TLDR: Delete $HOME/.cache/zsh/zcompdump
, open a new terminal and your custom completion should be present.
When you execute compinit
, there's a zcompdump
that is created: https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Completion-System
To speed up the running of compinit, it can be made to produce a dumped configuration that will be read in on future invocations; this is the default, but can be turned off by calling compinit with the option -D. The dumped file is .zcompdump in the same directory as the startup files (i.e. $ZDOTDIR or $HOME); alternatively, an explicit file name can be given by ‘compinit -d dumpfile’. The next invocation of compinit will read the dumped file instead of performing a full initialization.
You can see this file as some sort of cache.
Zephyr is using this file in a smarter way: https://github.com/mattmc3/zephyr/blob/81193c9683c6a212efbcc4c07b62c9e62317fc93/plugins/completion/functions/run-compinit#L16-L33
The "cache" is 20 hours long, so unless you delete it yourself, your configuration will not have your new completion file.
Or, if you replace zephyr completions with zsh-utils' completion plugin, it works.
Zephyr is looking for zcompdump
at $HOME/.cache/zsh/zcompdump
: https://github.com/mattmc3/zephyr/blob/81193c9683c6a212efbcc4c07b62c9e62317fc93/plugins/completion/functions/run-compinit#L16
whereas zsh-utils
looks at either $HOME/.cache/zsh/compdump
or $HOME/.zcompdump
or $HOME/.config/zsh/.zcompdump
depending on your config: https://github.com/belak/zsh-utils/blob/0e3238b6462fd5cd7c4c6b5d1dccbe5a69d2b5b4/completion/completion.plugin.zsh#L14-L18
So my guess is that when you switched to zsh-utils
, you created a new cache and could use your poetry completion.
Thanks, I'll have a look later on. Closing this since this is no longer an issue for me (and seems like something at my end rather than a bug).
Local completion files are not loaded after
compinit
. I tried to load completion forpoetry
by putting it in a completion directory but that did not work.The steps to reproduce below walk through
poetry
completion but I think it should work for any local ZSH completion script.System information
Steps to reproduce
<path-to-zshrc-dir>
)..zshrc
```zsh # Where to put antidote files? ANTIDOTE_HOME=$ZDOTDIR/plugins/.external # Get antidote if not already present [[ -e $ZDOTDIR/.antidote ]] || git clone --depth=1 https://github.com/mattmc3/antidote.git $ZDOTDIR/.antidote # Set the name of the static .zsh plugins file antidote will generate. ZSH_PLUGINS_FILE=${ZDOTDIR:-~}/.zplugins.zsh # Ensure you have a .zplugins.txt file where you can add plugins. [[ -f ${ZSH_PLUGINS_FILE:r}.txt ]] || touch ${ZSH_PLUGINS_FILE:r}.txt # Lazy-load antidote. fpath+=(${ZDOTDIR:-~}/.antidote/functions) autoload -Uz $fpath[-1]/antidote # Install all plugins there are if not already done [[ -e $ZDOTDIR/plugins/.external ]] || antidote load $ZDOTDIR/.zplugins.txt # Generate static file in a subshell when .zsh_plugins.txt is updated. if [[ ! $ZSH_PLUGINS_FILE -nt ${ZSH_PLUGINS_FILE:r}.txt ]] || [[ ! -s $ZSH_PLUGINS_FILE ]]; then source $ZDOTDIR/.antidote/antidote.zsh (envsubst < ${ZSH_PLUGINS_FILE:r}.txt | antidote bundle >| $ZSH_PLUGINS_FILE) fi # Source your static plugins file. source $ZSH_PLUGINS_FILE # vim: ft=zsh sw=2 ts=2 et ```.zplugins.txt
```zsh $ZDOTDIR/completions kind:fpath # belak/zsh-utils path:completion mattmc3/zephyr path:plugins/completion # vim: ft=zsh sw=2 ts=2 et ```<path-to-zshrc-dir>/completions/_poetry
usingpoetry completions zsh > <path-to-zshrc-dir>/completions/_poetry
. (docs). This can be replaced with any completion, but this is the one I am trying to get to work.ZDOTDIR=<path-to-zshrc-dir> zsh
.poetry <TAB>
should show completions but it does not.What works?
compinit
after step 3, and then dopoetry <TAB>
, you get completions.zephyr completions
withzsh-utils
' completion plugin, it works.Thanks for your amazing work on this and for sharing your dotfiles. They helped me a lot to get my zsh in order :heart: