romkatv / zsh-defer

Deferred execution of Zsh commands
GNU General Public License v3.0
356 stars 11 forks source link

Input hangs while zsh-defer is doing work #13

Closed lindhe closed 1 year ago

lindhe commented 1 year ago

Input hangs ("my terminal freezes") while zsh-defer is doing work. The prompt shows up immediately, but I cannot do anything with it until everything has loaded.

Is that normal/intended, or have I likely misconfigured something?

romkatv commented 1 year ago

When a deferred action is executing, zsh cannot do anything and will appear frozen. All buffered keyboard input is processed after the current deferred action finishes executing. If there are more deferred actions scheduled to run after that, they will start only after the buffered keyboard input is processed.

romkatv commented 1 year ago

It's also worth mentioning that I'm not aware of any valid use cases for zsh-defer. All uses of zsh-defer that I've seen are basically misguided. See https://github.com/romkatv/zsh-bench#deferred-initialization.

lindhe commented 1 year ago

When a deferred action is executing, zsh cannot do anything and will appear frozen.

Thanks, I suspected that.

It's also worth mentioning that I'm not aware of any valid use cases for zsh-defer.

Maybe lead with that in the README? 🤣

romkatv commented 1 year ago

It's also worth mentioning that I'm not aware of any valid use cases for zsh-defer.

Maybe lead with that in the README? 🤣

That's fair. The docs are quite circumspect about it but they do link to https://github.com/romkatv/zsh-bench#deferred-initialization, which culminates in "So much for deferred initialization. Cannot recommend."

If I directly say that zsh-defer is useless in my opinion, it would imply that Turbo mode in zinit is worse than useless (it is after all worse than zsh-defer). This might unnecessarily upset people. I think deferred initialization is a wrong tool for the job but for folks who disagree there is a high quality implementation right here. I won't judge them.

lindhe commented 1 year ago

Sounds very reasonable. 👍