Example Minimal Setup#
zinit wait lucid light-mode for \
atinit"zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
atload"_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions
wait
– load 0 seconds (about 5 ms exactly) after prompt (Turbo mode),lucid
– silence the under-prompt messages ("Loaded {name of the plugin}
"),light-mode
– load the plugin inlight
mode, in which the tracking of plugin (i.e. activity report gathering, accessible via thezinit report {plugin-spec}
subcommand) is being disabled; note that for Turbo mode, the performance gains are almost0
, so in this mode you can load all plugins with the tracking, i.e.: thelight-mode
ice can be removed from the command,atpull''
– execute after updating the plugin – the command in the ice will install any new completions,atinit''
– execute code before loading plugin,atload''
– execute code after loading plugin,zicompinit
– equals toautoload compinit; compinit
,zicdreplay
– executecompdef …
calls that plugins did – they were recorded, so thatcompinit
can be called later (compinit
provides thecompdef
function, so it must be ran before issuing the taken-overcompdef
s withzicdreplay
),- syntax-highlighting plugins (like
fast-syntax-highlighting
or
zsh-syntax-highlighting)
theoretically expect to be loaded last, even after the completion
initialization (i.e.
compinit
function), however, in practice, you just have to ensure that such plugin is loaded after plugins that are issuingcompdef
s – which basically means completions that aren't using the underscore-starting function file; the completion initialization still has to be performed before syntax-highlighting plugin, hence theatinit''
ice, which will loadcompinit
right before loading the plugin, - the syntax-highlighting and suggestions plugins are loaded early for a better user experience.
The same setup but without using Turbo mode (i.e. no wait''
ice) and without
the for-syntax:
zinit ice blockf atpull'zinit creinstall -q .'
zinit light zsh-users/zsh-completions
autoload compinit
compinit
zinit light zdharma-continuum/fast-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions
Without Turbo the syntax-highlighting plugin can be loaded at the end, as it doesn't make any difference (the prompt will appear after loading all objects, anyway).