With a clean install of zplug using git clone and the following in ~/.zshrc, zplug will create ~/.zcompdump, ~/.zplug/zcompdump, and ~/.zplug/zcompdump.zwc. I would expect only one of those files to be created.
uname -a
Darwin xdgrady 14.5.0 Darwin Kernel Version 14.5.0: Thu Jun 16 19:58:21 PDT 2016; root:xnu-2782.50.4~1/RELEASE_X86_64 x86_64
zsh version
zsh 5.0.5 (x86_64-apple-darwin14.0)
zplug version/commit
2.2.0
Create a minimal reproducing set of configurations for this issue. Please
remove all unnecessary parts!
export ZPLUG_HOME="$HOME/.zplug"
source "$ZPLUG_HOME/init.zsh"
zplug load
~/.zshrc; remove all other zsh config filesrm -rf ~/.zplugrm ~/.zcompdumpgit clone https://github.com/zplug/zplug ~/.zplugThe 2 files $ZPLUG_HOME /zcompdump{,.zwc} are produced by:
compinit -d <dumpfile> - inits the completion system and dumps completions to <dumpfile>zcompile <dumpfile> - creates a "compiled" version <dumpfile>.zwc for faster loading~zplug/autoload/commands/load
245: compinit -C -d "$ZPLUG_HOME/zcompdump"
248: zcompile "$ZPLUG_HOME/zcompdump"
The file ~/.zcompdump might be created by a loaded plugin that calls compinit without the -d flag.
You should check wether your .zshrc includes a compinit call or check the repos directory for plugins calling compinit with something like:
grep -in compinit ~/.zshrc ~/.zplug/repos
... and remove these lines from i.e. your .zshrc.
BTW you can check which was the last zcompdump file that was loaded and/or created in your active session:
print $_comp_dumpfile
I don't think another plugin or shell config file creates ~/.zcompdump. Try my steps to reproduce; I remove all ZSH configuration files and the entire zplug directory hierarchy (including the repos directory) to test this, and I don't load any plugins. So from a completely clean install with no plugins, the two commands
source "$ZPLUG_HOME/init.zsh"
zplug load
seem to be sufficient to reproduce this behavior, which suggests that something in zplug's startup sequence calls compinit prematurely.
I delved into zplug's code and it's definitely causing the problem itself: it calls compinit twice, once when init.zsh is sourced and once during zplug load. The former call, which is almost certainly the erroneous one, occurs in base/core/core.zsh:
# Run compinit if zplug comp file hasn't load
if (( ! $+functions[_zplug] )); then
compinit
fi
Deleting this call seems to fix the issue entirely - zplug no longer creates ~/.zcompdump, and it still has working completion. So… is that call needed at all?
Thanks for reporting! The compinit that @00dani pointed out is needed in case ~/.zplug/init.zsh is sourced but zplug load isn't called. However, I made it so that the zcompdump file is generated to $ZPLUG_HOME/zcompdump in the first invocation. Please try out the latest master and see if this fixes the problem.
Most helpful comment
I delved into zplug's code and it's definitely causing the problem itself: it calls
compinittwice, once wheninit.zshis sourced and once duringzplug load. The former call, which is almost certainly the erroneous one, occurs inbase/core/core.zsh:Deleting this call seems to fix the issue entirely - zplug no longer creates ~/.zcompdump, and it still has working completion. So… is that call needed at all?