The usage of typeset within zsh's scope rules means that if the
eval "$(forge zsh plugin)" is run within a function, the typeset's will
be function local scoped. However, forge expects these to be globally
scoped. This can be fixed by specifying typeset -g to be global instead
of scoped to whatever scope it currently is.
With this fixed, it would allow lazy loading plugin managers to work, or
in my case, by manually wrapping the forge initialization into
a function:
forge_ai() {
if [[ -z "$_FORGE_PLUGIN_LOADED" ]]; then
eval "$(forge zsh plugin)"
fi
}
This allows me to load forge when I want to, instead of it being always
initialized on startup.
The usage of typeset within zsh's scope rules means that if the eval "$(forge zsh plugin)" is run within a function, the typesets will be function local scoped. However, forge expects these to be globally scoped. This can be fixed by specifying typeset -g to be global instead of scoped to whatever scope it currently is.
With this fixed, it would allow lazy loading plugin managers to work, or in my case, by manually wrapping the forge initialization into a function:
forge_ai() { if [[ -z "$_FORGE_PLUGIN_LOADED" ]]; then eval "$(forge zsh plugin)" fi }This allows me to load forge when I want to, instead of it being always initialized on startup.
Most of the typesets are regular arrays, however, zsh-syntax-highlighting's ZSH_HIGHLIGHT_PATTERNS is an associative array, so we need to use -gA instead for that variable.
Reverts #2770