zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
3.2k stars 129 forks source link

[bug]: Loading completion with `wait` doesn't work #634

Open kuator opened 10 months ago

kuator commented 10 months ago

What happened?

I'm trying to load zsh-completions using wait.

Steps to reproduce

### Added by Zinit's installer
ZINIT_DIR="$XDG_DATA_HOME/zinit"
ZINIT_HOME="$ZINIT_DIR/zinit.git"
if [[ ! -f $ZINIT_HOME/zinit.zsh ]]; then
    print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
    command mkdir -p "$ZINIT_DIR" && command chmod g-rwX "$ZINIT_DIR"
    command git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME" && \
        print -P "%F{33} %F{34}Installation successful.%f%b" || \
        print -P "%F{160} The clone has failed.%f%b"
fi

source "$ZINIT_HOME/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
### End of Zinit's installer chunk

# zsh-users/zsh-completions
# zinit light zsh-users/zsh-completions
zinit wait lucid light-mode for \
  as'completion' \
  atdelete'zinit cuninstall completions' \
  atload"zicompinit; zicdreplay" \
  atpull'zinit creinstall -q "$PWD"' \
  blockf \
  id-as'auto' \
  @zsh-users/zsh-completions

Completion doesn't work. But if I manually call compinit, then it does work. Peek 2024-01-26 15-51 The completion also starts to work, If I remove the wait modifier:

zinit lucid light-mode for \
  as'completion' \
  atdelete'zinit cuninstall completions' \
  atload"zicompinit; zicdreplay" \
  atpull'zinit creinstall -q "$PWD"' \
  blockf \
  id-as'auto' \
  @zsh-users/zsh-completions

The problem is it's very slow now:

$ time zsh -i -c exit             
zsh -i -c exit  0,44s user 0,18s system 100% cpu 0,618 total

Relevant output

No response

Screenshots and recordings

No response

Operating System & Version

OS: linux-gnu | Vendor: ubuntu | Machine: x86_64 | CPU: x86_64 | Processor: x86_64 | Hardware: x86_64

Zsh version

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

Terminal emulator

xterm-256color

If using WSL on Windows, which version of WSL

None

Additional context

No response

Code of Conduct