zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.95k stars 126 forks source link

"zinit pack" does not work when called within .zshrc #149

Closed jmgq closed 2 years ago

jmgq commented 2 years ago

Issue description

As part of my .zshrc file, I run zinit pack'binary+keys' for fzf, but it does not work at all, there is not even any output whatsoever. If manually I run said command in a terminal, it correctly installs fzf.

I have also tried this with other packs, such as pyenv, but the result is the same.

The rest of the commands in .zshrc work as expected.

zinit config

The following .zshrc downloads zinit if it wasn't already present, sources it, loads some plugins (including jq, necessary for the pack ice), then installs the Patch DL annex and finally install the fzf pack.

# Install Zinit
[[ ! -f ~/.zinit/bin/zinit.zsh ]] && {
    command mkdir -p ~/.zinit
    command git clone https://github.com/zdharma-continuum/zinit ~/.zinit/bin
}

# Use Zinit
source ~/.zinit/bin/zinit.zsh

# Load Zinit plugins
zinit wait lucid light-mode for \
        OMZL::clipboard.zsh \
        lukechilds/zsh-nvm \
    from'gh-r' as'program' mv'jq-* -> jq' pick'jq' \
        stedolan/jq

# Install fzf with key bindings (like Ctrl+R)
zinit light zdharma-continuum/zinit-annex-patch-dl
zinit pack'binary+keys' for fzf

zinit version or commit ID

9ee45d6804fdf4972a9e913a1ad86d77de124231

zsh version

zsh 5.8 (x86_64-apple-darwin21.0)

Host info

MacOS Monterrey v12.0.1

pschmitt commented 2 years ago

I think the issue here is that zinit pack requires jq, but in your config you only load the jq plugin later.

Please try adding wait"0z" to your zinit pack call.

jmgq commented 2 years ago

@pschmitt thank you very much for your quick reply. That solved the problem :-)

This wasn't a bug after all. I was confused because this very same config used to work a few months ago, but after reading the Changelog it looks like jq being a dependency of pack is relatively new, so that's why it stopped working for me.