Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow zinit to be run from non-interactive scripts #227

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:
- name: "gh-r"
run: zunit run tests/gh-r.zunit

- name: "ices"
run: zunit run tests/ices.zunit

- name: "plugins"
run: zunit run tests/plugins.zunit

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ txt/
zmodules/
tests/_output/
tests/_support/zunit/
.idea
2 changes: 1 addition & 1 deletion doc/zsdoc/zinit-install.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ ____
FUNCTION: ∞zinit-cp-hook [[[
____

Has 27 line(s). Calls functions:
Has 30 line(s). Calls functions:

∞zinit-cp-hook
`-- zinit.zsh/@zinit-substitute
Expand Down
4 changes: 3 additions & 1 deletion doc/zsdoc/zinit.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,9 @@ ____
Registers the z-annex inside Zinit – i.e. an Zinit extension
____

Has 4 line(s). Doesn't call other functions.
Has 6 line(s). Doesn't call other functions.

Uses feature(s): _setopt_

Called by:

Expand Down
2 changes: 1 addition & 1 deletion tests/gh-r.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
$dive --version; assert $state equals 0
}
@test 'docker-buildx' { # A monitor of resources
run zinit for as'completions' atclone'buildx* completion zsh > _buildx' lbin'!buildx-* -> buildx' @docker/buildx
run zinit for as'completions' atclone'./buildx* completion zsh > _buildx' lbin'!buildx-* -> buildx' @docker/buildx
vladdoster marked this conversation as resolved.
Show resolved Hide resolved
assert $state equals 0
local buildx="$ZBIN/buildx"; assert "$buildx" is_executable
$buildx version; assert $state equals 0
Expand Down
52 changes: 52 additions & 0 deletions tests/ices.zunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env zunit

@setup {
ZPLUGINS=$ZINIT[PLUGINS_DIR]

function _zunit_assert_not_exists() {
vladdoster marked this conversation as resolved.
Show resolved Hide resolved
local pathname=$1 filepath

# If filepath is relative, prepend the test directory
if [[ "${pathname:0:1}" != "/" ]]; then
filepath="$testdir/${pathname}"
else
filepath="$pathname"
fi

[[ ! -e "$filepath" ]] && return 0

echo "'$pathname' does exist"
exit 1
}

}

@test 'mv' {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these tests verify this fix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in, are these tests running interactively?

Copy link
Contributor Author

@jankatins jankatins May 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are running non-interactively, as all zunit tests. I'm not aware of any way to run them interactively (which probably is because of my zsh skill) :-(

Given that the bug (this PR should fix) is about making zinit able to run in (non-interactive) scripts, this is exactly what is getting fixed and tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did run with this fix for the last weeks and redid my setup multiple times, so I'm fairly confident it will not break interactive sessions.

run zinit as"null" id-as"test/mv" mv"readme.md -> mv.md" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---mv/mv.md" is_file
assert "$ZPLUGINS/test---mv/mv.md" is_file
assert "$ZPLUGINS/test---mv/readme.md" not_exists
}

@test 'cp' {
run zinit as"null" id-as"test/cp" cp"readme.md -> cp.md" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---cp/cp.md" is_file
assert "$ZPLUGINS/test---cp/cp.md" is_readable
assert "$ZPLUGINS/test---cp/readme.md" is_file
}

@test 'atclone' {
run zinit as"null" id-as"test/atclone" atclone"mv readme.md atclone.md" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---atclone/atclone.md" is_file
assert "$ZPLUGINS/test---atclone/atclone.md" is_readable
assert "$ZPLUGINS/test---atclone/readme.md" not_exists
}

@test 'make' {
run zinit as"null" id-as"test/make" atclone"printf 'all:\n\ttouch whatever\n' > Makefile" make"" for zdharma-continuum/null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this works. I'd expect it to fail as AFAIK it tries to run make install.

Copy link
Contributor Author

@jankatins jankatins May 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three places in zinit which i found run command make -C "$dir" ${(@s; ;)${make#\!\!}} so no mention of install (as far as I understand this line)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI: this is the wording of an example in the readme: from my reading, it's in line with the code, i.e. if install is not the default make target, you have explicitly supply the target:

# Scripts built at install (there's single default make target, "install",
# and it constructs scripts by `cat'ing a few files). The make'' ice could also be:
# `make"install PREFIX=$ZPFX"`, if "install" wouldn't be the only default target.
zinit ice as"program" pick"$ZPFX/bin/git-*" make"PREFIX=$ZPFX"
zinit light tj/git-extras

assert $state equals 0
assert "$ZPLUGINS/test---make/whatever" is_file
}
7 changes: 5 additions & 2 deletions tests/snippets.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@
}
@test 'tldr-completion::gh-r' {
artifact="$ZINIT[PLUGINS_DIR]/tldr-completion---gh-r"
run zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" @dbrgn/tealdeer
run zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @dbrgn/tealdeer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc you shouldn't need the move ice, but I forget why. It was something that seemed somewhat magical.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit odd, if its a completion, you shouldn't need to source it as well via the pick ice ... right?

Copy link
Contributor Author

@jankatins jankatins May 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, no idea: given that this shows up as a CI failure when the fix is applied and the test does not actually check for the existence of the completion, I would argue that it documents the status quo. Should I open a new bug report about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the output of a zinit call on current main with the old call in an interactive session, showing that no completion got installed:

~/.zinit/bin on  main (07cde660) [?] [🐳: local]

[22:31:59] λ  zinit delete tldr-completion/gh-r -y

Done (action executed, exit code: 0)


~/.zinit/bin on  main (07cde660) [?] [🐳: local]

[22:32:07] λ  zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" @dbrgn/tealdeer

Downloading dbrgn/tealdeer… (at label: tldr-completion/gh-r…)
(Requesting `completions_zsh'…)
#################################################################################################################################################################################################################### 100.0%
ziextract: WARNING: didn't recognize the archive type of `completions_zsh'  }(no extraction has been done).%f%b
No files for compilation found.
Warning: ∞zinit-compile-plugin-hook hook returned with 1


~/.zinit/bin on  main (07cde660) [?] [🐳: local]

[22:32:15] [1] ✗  ls -la ~/.zinit/completions/ | grep tldr


~/.zinit/bin on  main (07cde660) [?] [🐳: local]

[22:32:21] [1] ✗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #310 for this problem -> I also added an interactive session there which shows that you need the rename and the pick to link the completion into the right dir.

assert $state equals 0
assert "$artifact/completions_zsh" is_file; assert $artifact is_readable
assert "$artifact/_tldr_ghr" is_file
assert $artifact/_tldr_ghr is_readable
assert "$ZINIT[COMPLETIONS_DIR]"/_tldr_ghr is_file
assert "$ZINIT[COMPLETIONS_DIR]"/_tldr_ghr is_readable
}
@test 'zinit local snippet symlink' {
mkdir -p "${ZINIT[HOME_DIR]}/external"
Expand Down
18 changes: 9 additions & 9 deletions zinit-autoload.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1567,9 +1567,9 @@ ZINIT[EXTENDED_GLOB]=""
# Run annexes' atpull hooks (the before atpull-ice ones).
# The gh-r / GitHub releases block.
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down Expand Up @@ -1656,9 +1656,9 @@ ZINIT[EXTENDED_GLOB]=""
# Run annexes' atpull hooks (the before atpull-ice ones).
# The regular Git-plugins block.
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down Expand Up @@ -1703,9 +1703,9 @@ ZINIT[EXTENDED_GLOB]=""
# Run annexes' atpull hooks (the before atpull[^!]…-ice ones).
# Block common for Git and gh-r plugins.
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\\\!atpull-pre <->]}
${${ICE[atpull]:#\!*}:+${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\\\!atpull-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\!atpull-pre <->]}
${${ICE[atpull]:#\!*}:+${(on)ZINIT_EXTS[(I)z-annex hook:\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\!atpull-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down
43 changes: 24 additions & 19 deletions zinit-install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
# Store ices at clone of a plugin
.zinit-store-ices "$local_path/._zinit" ICE "" "" "" ""
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:\\\!atclone-pre <->]}
${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atclone-<-> <->]}
Copy link
Contributor Author

@jankatins jankatins Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladdoster Probably this changed line broke zdharma-continuum/zinit-annex-patch-dl#6

... and the similar changes to ZINIT_EXTS lines below...

${(on)ZINIT_EXTS2[(I)zinit hook:\\\!atclone-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:\!atclone-pre <->]}
${(on)ZINIT_EXTS[(I)z-annex hook:\!atclone-<-> <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:\!atclone-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down Expand Up @@ -999,9 +999,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
# Run annexes' atpull hooks (the before atpull-ice ones).
# The SVN block.
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down Expand Up @@ -1093,9 +1093,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
# The URL-snippet block.
if [[ $update = -u && $ZINIT[annex-multi-flag:pull-active] -ge 1 ]] {
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-pre <->]}
${${ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-pre <->]}
${${ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down Expand Up @@ -1153,9 +1153,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
# The local-file snippets block.
if [[ $update = -u ]] {
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\\\!atpull-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-pre <->]}
${${(M)ICE[atpull]#\!}:+${(on)ZINIT_EXTS[(I)z-annex hook:\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:e-\!atpull-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down Expand Up @@ -1248,9 +1248,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
# Run annexes' atpull hooks (the before atpull-ice ones).
# The block is common to all 3 snippet types.
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\\\!atpull-pre <->]}
${${ICE[atpull]:#\!*}:+${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\\\!atpull-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\!atpull-pre <->]}
${${ICE[atpull]:#\!*}:+${(on)ZINIT_EXTS[(I)z-annex hook:\!atpull-<-> <->]}}
${(on)ZINIT_EXTS2[(I)zinit hook:no-e-\!atpull-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand All @@ -1265,9 +1265,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
# Run annexes' atclone hooks (the before atclone-ice ones)
# The block is common to all 3 snippet types.
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:\\\!atclone-pre <->]}
${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atclone-<-> <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:\\\!atclone-post <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:\!atclone-pre <->]}
${(on)ZINIT_EXTS[(I)z-annex hook:\!atclone-<-> <->]}
${(on)ZINIT_EXTS2[(I)zinit hook:\!atclone-post <->]}
)
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
Expand Down Expand Up @@ -2360,18 +2360,23 @@ zimv() {

@zinit-substitute from to

local -a afr
local -a afr retval
( () { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1
afr=( ${~from}(DN) )
if (( ${#afr} )) {
if (( !OPTS[opt_-q,--quiet] )) {
command cp -vf "${afr[1]}" "$to"
retval=$?
# ignore errors if no compiled file is found
command cp -vf "${afr[1]}".zwc "$to".zwc 2>/dev/null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: the cp hook wasn't run and therefore the second cp which tries to copy the compiled files fails now. Pattern with retval is the same as a few lines above in mv hook.

} else {
command cp -f "${afr[1]}" "$to"
retval=$?
# ignore errors if no compiled file is found
command cp -f "${afr[1]}".zwc "$to".zwc 2>/dev/null
}
}
return $retval
)
}
# ]]]
Expand Down
18 changes: 12 additions & 6 deletions zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,12 @@ builtin setopt noaliases
# FUNCTION: @zinit-register-hook. [[[
# Registers the z-annex inside Zinit – i.e. an Zinit extension
@zinit-register-hook() {
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
# zsh per default behaves differently in interactive sessions (escapes !) and
# non-interactive ones (does not). Setting 'nobanghist' option disables backslash
# escaping for "!" even in interactive sessions.
# Exclamation marks are used in a lot of hock names.
builtin setopt extendedglob nobanghist noshortloops typesetsilent warncreateglobal
local name="$1" type="$2" handler="$3" icemods="$4" key="zinit ${(q)2}"
ZINIT_EXTS2[seqno]=$(( ${ZINIT_EXTS2[seqno]:-0} + 1 ))
ZINIT_EXTS2[$key${${(M)type#hook:}:+ ${ZINIT_EXTS2[seqno]}}]="${ZINIT_EXTS2[seqno]} z-annex-data: ${(q)name} ${(q)type} ${(q)handler} '' ${(q)icemods}"
Expand Down Expand Up @@ -1391,7 +1397,7 @@ builtin setopt noaliases

ZINIT[CUR_USPL2]="$id_as" ZINIT_REPORTS[$id_as]=

reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atinit-<-> <->]} )
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\!atinit-<-> <->]} )
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atinit || \
Expand Down Expand Up @@ -1453,7 +1459,7 @@ builtin setopt noaliases
[[ -n ${ICE[multisrc]} ]] && { local ___oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; }; eval "reply=(${ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }; local fname; for fname in "${reply[@]}"; do ZERO="${${(M)fname:#/*}:-$local_dir/$dirname/$fname}"; (( ${+ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; done; }

# Run the atload hooks right before atload ice.
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atload-<-> <->]} )
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\!atload-<-> <->]} )
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atload
Expand Down Expand Up @@ -1507,7 +1513,7 @@ builtin setopt noaliases
[[ -n ${ICE[multisrc]} ]] && { local ___oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; }; eval "reply=(${ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }; local fname; for fname in "${reply[@]}"; do ZERO="${${(M)fname:#/*}:-$local_dir/$dirname/$fname}"; (( ${+ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; done; }

# Run the atload hooks right before atload ice.
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atload-<-> <->]} )
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\!atload-<-> <->]} )
for key in "${reply[@]}"; do
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atload
Expand Down Expand Up @@ -1624,7 +1630,7 @@ builtin setopt noaliases
.zinit-setup-params && local ${(Q)reply[@]}
}

reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atinit-<-> <->]} )
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\!atinit-<-> <->]} )
for ___key in "${reply[@]}"; do
___arr=( "${(Q)${(z@)ZINIT_EXTS[$___key]}[@]}" )
"${___arr[5]}" plugin "$___user" "$___plugin" "$___id_as" "${${${(M)___user:#%}:+$___plugin}:-${ZINIT[PLUGINS_DIR]}/${___id_as//\//---}}" \!atinit || \
Expand Down Expand Up @@ -1725,7 +1731,7 @@ builtin setopt noaliases
[[ -n ${ICE[multisrc]} ]] && { local ___oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$___pdir_orig"; }; eval "reply=(${ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }; local ___fname; for ___fname in "${reply[@]}"; do ZERO="${${(M)___fname:#/*}:-$___pdir_orig/$___fname}"; (( ${+ICE[silent]} )) && { { [[ -n $___precm ]] && { builtin ${___precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); $___builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( ___retval += $? )); ((1)); } || { ((1)); { [[ -n $___precm ]] && { builtin ${___precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); $___builtin source "$ZERO"; }; }; (( ___retval += $? )); }; done; }

# Run the atload hooks right before atload ice.
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atload-<-> <->]} )
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\!atload-<-> <->]} )
for ___key in "${reply[@]}"; do
___arr=( "${(Q)${(z@)ZINIT_EXTS[$___key]}[@]}" )
"${___arr[5]}" plugin "$___user" "$___plugin" "$___id_as" "$___pdir_orig" \!atload
Expand Down Expand Up @@ -1776,7 +1782,7 @@ builtin setopt noaliases
[[ -n ${ICE[multisrc]} ]] && { local ___oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$___pdir_orig"; }; eval "reply=(${ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }; for ___fname in "${reply[@]}"; do ZERO="${${(M)___fname:#/*}:-$___pdir_orig/$___fname}"; (( ${+ICE[silent]} )) && { { [[ -n $___precm ]] && { builtin ${___precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); $___builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( ___retval += $? )); ((1)); } || { { [[ -n $___precm ]] && { builtin ${___precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); $___builtin source "$ZERO"; }; }; (( ___retval += $? )); } done; }

# Run the atload hooks right before atload ice.
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\\\!atload-<-> <->]} )
reply=( ${(on)ZINIT_EXTS[(I)z-annex hook:\!atload-<-> <->]} )
for ___key in "${reply[@]}"; do
___arr=( "${(Q)${(z@)ZINIT_EXTS[$___key]}[@]}" )
"${___arr[5]}" plugin "$___user" "$___plugin" "$___id_as" "$___pdir_orig" \!atload
Expand Down