Skip to content

Review findings: zinit config issues (mixed ice syntax, fbin target, POSIX guards) #2

Description

@turboBasic

Context

Review of the zinit plugin configuration in ~/.config/zsh/.include/zinit_*.zsh against docs/ZINIT.md conventions. Five issues found, ordered by impact.


Issues

1. Mixed ice syntax on sindresorhus/pure — legacy form in a ---prefix block

zinit_50_plugins.zsh, lightweight block:

--compile='(pure|async).zsh' pick='async.zsh' src='pure.zsh' \
sindresorhus/pure \

pick= and src= use the legacy positional ice'value' form. Every other ice in the file and the ZINIT.md convention use the -- prefix form exclusively. Mixing forms in the same for block is inconsistent and will confuse future edits.

Fix:

--compile='(pure|async).zsh' --pick='async.zsh' --src='pure.zsh' \
sindresorhus/pure \

See docs/ZINIT.md § "Ice modifier notation" and "Common Mistakes to Avoid".


2. Bare --fbin with no argument on jdx/usage — implicit binary name

zinit_50_plugins.zsh, heavy/turbo block:

--as='null' \
--from='gh-r' \
--fbin \
jdx/usage \

--fbin with no argument relies on auto-detection (plugin name, URL trailing component, or first executable). The binary inside the release is usage, but relying on auto-detection is fragile if the release asset naming ever changes.

Fix: be explicit:

--fbin='usage' \

3. zinit_00_install.zsh — POSIX [ ] test and unquoted $ZINIT_HOME

zinit_00_install.zsh:

if [ ! -d $ZINIT_HOME/.git ]; then
    mkdir -p "$ZINIT_HOME"
    git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
source $ZINIT_HOME/zinit.zsh

Two issues:

  • [ ! -d $ZINIT_HOME/.git ] uses POSIX [ ] in a file that targets Zsh; prefer [[ ]] to avoid glob expansion on $ZINIT_HOME.
  • $ZINIT_HOME is quoted in mkdir and git clone but not in the [ -d ] test or the source line — inconsistent quoting.

Fix:

if [[ ! -d "$ZINIT_HOME/.git" ]]; then
    mkdir -p "$ZINIT_HOME"
    git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
source "$ZINIT_HOME/zinit.zsh"

4. zinit_90_completions.zsh — per-iteration zinit ... for loop for _curl

for c in $completions; do
    zinit --light-mode \
        --lucid \
        --wait \
        --as='completion' \
        --is-snippet \
        --id-as="$(basename "$c")" \
        for "$c"
done

This spawns a separate zinit ... for invocation per completion file. Currently there is only one entry (_curl), so it works — but the pattern is inconsistent with the batch for block immediately below. If more completions are added to the array, each gets its own zinit call instead of being grouped.

Fix: add _curl as a guarded entry directly in the batch for block below, using --has or --if to gate on the file's existence, and remove the loop.


5. zinit_20_macos.zsh single-plugin block missing --light-mode

zinit for \
    --lucid \
    --wait \
    ...
    mbadolato/iTerm2-Color-Schemes

All other turbo blocks in zinit_50_plugins.zsh that use --wait without --light-mode still track the plugin (zinit normal mode). For a plugin loaded with --as='null' that only copies a file, tracking adds overhead with no benefit.

Fix: add --light-mode to the block:

zinit --light-mode for \
    --lucid \
    --wait \
    ...

What is correct (no action needed)

  • Numbered file layout matches docs/ZINIT.md exactly; all 8 documented slots present
  • Annexes loaded synchronously before any turbo plugins
  • fast-syntax-highlighting in zinit_99_last.zsh with wait='1c' + compinit
  • zsh-autosuggestions with atload='!_zsh_autosuggest_start'
  • --run-atpull + --atpull='%atclone' pattern used consistently throughout
  • --nocompile='!' used wherever atclone generates files that need compiling
  • # last line ;) trailing-comment pattern maintained consistently
  • Platform gate and profile dispatch correctly wired in .zshrc.tmpl

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions