Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

New Zplugin feature to increase startup time by 33%

consider following code:

  zplugin ice wait'[[ ${ZLAST_COMMANDS[(r)cras*]} ]]'
  zplugin light zdharma/zplugin-crasis

The package zplugin-crasis is not loaded after those commands. Zsh startup continues fast.

But when user enters "cras" on command line, then instantly the plugin is loaded and command "crasis" becomes available. See the feature in action:


One can also do wait'1' – 1 second delay.

I load 11 plugins, with wait'1' zsh startup time is 160 ms, normal loading is 240 ms – that is 33% difference.

It is like Windows showing desktop at startup but still loading in background. Except here there are no lags, command line is fully usable.

ZLAST_COMMANDS is built by my zdharma/fast-syntax-highlighting so it is required, but if Daniel agrees I will submit patch to zsh-syntax-highlighting. Z-sy-h processing loop tracks which token is at command position, it already has needed information to fill ZLAST_COMMANDS. A dedicated plugin is on the way, to not limit users to syntax-colored setups.

Sebastian Gniazdowski
psprint /at/ zdharma.org

Messages sorted by: Reverse Date, Date, Thread, Author