Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oh My Zsh compdef broken after v1.0.0 #40

Open
Avi-D-coder opened this issue Feb 27, 2023 · 9 comments
Open

Oh My Zsh compdef broken after v1.0.0 #40

Avi-D-coder opened this issue Feb 27, 2023 · 9 comments

Comments

@Avi-D-coder
Copy link
Contributor

This change breaks compdef for me. 656e503
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
Copy link
Owner

jedahan commented Feb 27, 2023

So you are saying that reverting that commit fixes things?

@jedahan
Copy link
Owner

jedahan commented Feb 27, 2023

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
Copy link
Owner

jedahan commented Feb 27, 2023

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
Copy link
Owner

jedahan commented Feb 27, 2023

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

@jedahan
Copy link
Owner

jedahan commented Mar 3, 2023

@Avi-D-coder any updates?

@Avi-D-coder
Copy link
Contributor Author

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
Copy link

eirnym commented Jan 22, 2024

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

@Avi-D-coder
Copy link
Contributor Author

autoload -Uz compinit;

I have that as well.

@jedahan
Copy link
Owner

jedahan commented Jan 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants