First prompt not working for Zinit lazy load #204
-
Environment
Does the bug occur without config files?
Which combination of config causes the bug to appear? source /usr/share/zsh/scripts/zinit/zinit.zsh
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
zinit wait lucid light-mode \
atinit"zstyle ':autocomplete:*' groups 'always'" \
atinit"zstyle ':autocomplete:(slash|space):*' magic 'off'" \
for marlonrichert/zsh-autocomplete Steps to reproduce
Expected behaviorAutocomplete plugin works on first prompt after it has been loaded. Also in lazy loading mode. Actual behaviorAutocomplete plugin works only from the second prompt on. Only without Soooo. after this long template: I guess there must be some function that I need to call manually when the plugin got loaded. So for example for the autosuggestion you do something like this (taken from zinit docs): zinit wait lucid light-mode \
atload"_zsh_autosuggest_start" \
for zsh-users/zsh-autosuggestions So is there maybe something like this? For the fast syntax highlight plugin it is |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
PS: At the same time I now have issues with zinit wait lucid light-mode \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
for zdharma/fast-syntax-highlighting Do you have an idea what this comes from? Should/do I need to open an issue there? |
Beta Was this translation helpful? Give feedback.
-
What you're seeing is a side-effect of using However, there's a much easier way to reduce your Zsh startup time: Just use Znap as your plugin manager and use its PS: |
Beta Was this translation helpful? Give feedback.
-
Okay so since autocomplete should load quite fast I guess is is fine to not use the lazy loading. I thought there is maybe a function that registers all the hooks that could be called manually after finished loading.
I already saw that you introduced your own plugin manager. I must admit that I'm tired of switching/reading about zsh plugin managers. I think now I'm on a fast one that is incredibly powerful. Probably too powerful and I wont need 90% of it. But after all I have the options, it works pretty well (well, I opened an issue here...) and appears more future stable to me. So I don't "need" to switch another time soon. But that is personal taste and as I said I'm pretty annoyed atm.
Thanks for the hint. I just adopted to the recent refactorings of you to make it work again as it was before. I should read the docs from scratch to get the recent features and changes properly set up. |
Beta Was this translation helpful? Give feedback.
-
Ah, anything to the correlation wit the fast syntax highlighting plugin? |
Beta Was this translation helpful? Give feedback.
-
Ah, that looks like a bug indeed. Thanks for finding it. I'll fix it. |
Beta Was this translation helpful? Give feedback.
-
It's funny that you say that: I wrote Znap exactly because I got annoyed with Zinit. 😁 Like you state, Zinit does much more stuff than you'll ever need. That by itself doesn't sound so bad, but I discovered Zinit actually does a bunch of stuff without asking and can thus unknowingly alter the behavior of your plugins or even slow down your shell at runtime. Couple that with a really strange syntax and I just got enough of it. |
Beta Was this translation helpful? Give feedback.
-
There currently isn't, but I could add one. |
Beta Was this translation helpful? Give feedback.
What you're seeing is a side-effect of using
zinit wait
:zsh-autocomplete
adds several hooks that run before the first prompt. However,zinit wait
delayszsh-autocomplete
initialization until after the first prompt, meaning it won't get to add its hooks until after the first prompt. This causes the hooks to not trigger until the next prompt. There's nothingzsh-autocomplete
can do about that. You'll just have to use it withoutzinit wait
.However, there's a much easier way to reduce your Zsh startup time: Just use Znap as your plugin manager and use its
znap prompt
command to make your prompt appear instantly. 😁PS:
zstyle ':autocomplete:(slash|space):*' magic 'off'
doesn't do anything an…