zdharma-continuum / zinit-annex-default-ice

A Zsh-Zinit extension that allows to define ices active for multiple zinit commands
GNU General Public License v3.0
2 stars 3 forks source link

light-mode ice doesn't work #4

Open twang817 opened 2 years ago

twang817 commented 2 years ago
zinit depth'3' light-mode for \
    zdharma-continuum/zinit-annex-default-ice

zinit default-ice -q depth'3' lucid light-mode

zinit wait for \
    atload'eval "$(lua z.lua --init zsh enhanced)"' \
        skywind3000/z.lua
$ zi report skywind3000/z.lua
Report for skywind3000/z.lua plugin
-----------------------------------
Source z.lua.plugin.zsh (reporting enabled)
Alias z=_zlua
Saving `compdef _zlua_zsh_tab_completion _zlua' for replay
Alias zz=z -i
Alias zc=z -c
Alias zf=z -I
Alias zb=z -b
Alias zbi=z -b -i
Alias zbf=z -b -I
Alias zh=z -I -t .
Alias zzc=zz -c

Functions created:
_zlua                    _zlua_precmd
_zlua_zsh_tab_completion

Variables added or redefined:
ZLUA_EXEC       [ "" -> scalar        ]
lua             [ "" -> scalar        ]
_ZL_FZF_FLAG    [ "" -> scalar-export ]
ZLUA_LUAEXE     [ "" -> scalar        ]
ZLUA_SCRIPT     [ "" -> scalar        ]
_ZL_MATCH_MODE  [ "" -> scalar-export ]

But

zinit depth'3' light-mode for \
    zdharma-continuum/zinit-annex-default-ice

zinit default-ice -q depth'3' lucid light-mode

zinit light-mode wait for \
    atload'eval "$(lua z.lua --init zsh enhanced)"' \
        skywind3000/z.lua
$ zi report skywind3000/z.lua
Report for skywind3000/z.lua plugin
-----------------------------------
Source z.lua.plugin.zsh (no reporting)
Saving `compdef _zlua_zsh_tab_completion _zlua' for replay
twang817 commented 2 years ago
❯ zi default-ice -s
lucid: 
light-mode: 
depth: 3
twang817 commented 2 years ago

Tracing the code, it seems light-mode is set at:

https://github.com/zdharma-continuum/zinit/blob/98d3eaa8beee3c650793b795e0f92ef1679d623e/zinit.zsh#L2672-L2674

This is in the main zinit function, long before preinit hooks are executed.

Rather than re-evaluating the ICES, .zinit-load-plugin relies on the $___mode passed to it to determine whether or not it will load modules in light mode.

It may be worth a comment somewhere in the README.md that light-mode can't be set by this annex.