jedahan / zr

zsh plugin manager written in rust
Mozilla Public License 2.0
180 stars 12 forks source link

Oh My Zsh compdef broken after v1.0.0 #40

Open Avi-D-coder opened 1 year ago

Avi-D-coder commented 1 year ago

This change breaks compdef for me. https://github.com/jedahan/zr/commit/656e5037718008d1b16b76a61ef1d173da850c33 The fix was adding autoload -Uz compinit; compinit -iCd $HOME/.zcompdump after zr ... > ~/.cache/zr.zsh /home/USER/.cache/zr/robbyrussell/oh-my-zsh.git/lib/directories.zsh:32: command not found: compdef

jedahan commented 1 year ago

So you are saying that reverting that commit fixes things?

jedahan commented 1 year ago

So the newest version of zr no longer loads compinit magically for the user, since different people may or may not want that

I believe this is an issue with oh-my-zsh

Can you share a minimal oh-my-zsh example zshrc with zr that I can test with?

jedahan commented 1 year ago

I recommend adding autoload -Uz compinit && compinit to your .zshrc

I wonder if there is a good place to add that to the docs...

jedahan commented 1 year ago

I would also be happy to add that minimal zshrc as a test case to run before release

jedahan commented 1 year ago

@Avi-D-coder any updates?

Avi-D-coder commented 1 year ago

Here's a minimal version of my config. Completions are also broken post 1.0.

# Generate new ~/.zr/init.zsh if it does not exist or ~/.zshrc is newer
if [[ ! -f ~/.config/zr.zsh ]] || [[ ~/.zshrc -nt ~/.config/zr.zsh ]]; then
    zr \
        robbyrussell/oh-my-zsh.git/lib/completion.zsh \
        robbyrussell/oh-my-zsh.git/lib/key-bindings.zsh \
        robbyrussell/oh-my-zsh.git/lib/history.zsh \
        robbyrussell/oh-my-zsh.git/lib/git.zsh \
        zsh-users/zsh-completions.git/src/ \
        zsh-users/zsh-autosuggestions.git/zsh-autosuggestions.zsh \
        junegunn/fzf.git/shell/key-bindings.zsh \
        Avi-D-coder/rust-zsh-completions.git \
        > ~/.cache/zr.zsh
    autoload -Uz compinit; compinit -iCd $HOME/.zcompdump
    source ~/.cache/zr/robbyrussell/oh-my-zsh.git/lib/directories.zsh
fi

source ~/.cache/zr.zsh
eirnym commented 10 months ago

I recommend to autoload -Uz compinit; before zr to make sure that everything sourced correctly

Avi-D-coder commented 10 months ago

autoload -Uz compinit;

I have that as well.

jedahan commented 10 months ago

Here's a minimal version of my config. Completions are also broken post 1.0.

# Generate new ~/.zr/init.zsh if it does not exist or ~/.zshrc is newer
if [[ ! -f ~/.config/zr.zsh ]] || [[ ~/.zshrc -nt ~/.config/zr.zsh ]]; then
    zr \
        robbyrussell/oh-my-zsh.git/lib/completion.zsh \
        robbyrussell/oh-my-zsh.git/lib/key-bindings.zsh \
        robbyrussell/oh-my-zsh.git/lib/history.zsh \
        robbyrussell/oh-my-zsh.git/lib/git.zsh \
        zsh-users/zsh-completions.git/src/ \
        zsh-users/zsh-autosuggestions.git/zsh-autosuggestions.zsh \
        junegunn/fzf.git/shell/key-bindings.zsh \
        Avi-D-coder/rust-zsh-completions.git \
        > ~/.cache/zr.zsh
    autoload -Uz compinit; compinit -iCd $HOME/.zcompdump
    source ~/.cache/zr/robbyrussell/oh-my-zsh.git/lib/directories.zsh
fi

source ~/.cache/zr.zsh

I wonder how to turn this example into a test we could run in CI/CD.