Problem
The normal plugin source path strips the character 1 instead of the deferred-hook marker ! when nocd is combined with atinit'!...'.
Current source:
|
.zi-tmp-subst-on "${___mode:-load}" |
|
# We need some state, but ___user wants his for his plugins. |
|
(( ${+ICE[blockf]} )) && { local -a fpath_bkp; fpath_bkp=( "${fpath[@]}" ); } |
|
local ZERO="$___pdir_path/$___fname" |
|
(( ${+ICE[aliases]} )) || builtin setopt noaliases |
|
[[ $ICE[atinit] = '!'* ]] && { local ___oldcd="$PWD"; (( ${+ICE[nocd]} == 0 )) && { () { builtin setopt localoptions noautopushd; builtin cd -q "${${${(M)___user:#%}:+$___plugin}:-${ZI[PLUGINS_DIR]}/${___id_as//\//---}}"; } && eval "${ICE[atinit]#!}"; ((1)); } || eval "${ICE[atinit]#1}"; () { builtin setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }; } |
|
(( ${+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 += $? )); } |
|
[[ -n ${ICE[src]} ]] && { ZERO="${${(M)ICE[src]##/*}:-$___pdir_orig/${ICE[src]}}"; (( ${+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 += $? )); }; } |
|
[[ -n ${ICE[multisrc]} ]] && { local ___oldcd="$PWD"; () { builtin setopt localoptions noautopushd; builtin cd -q "$___pdir_orig"; }; eval "reply=(${ICE[multisrc]})"; () { builtin 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; } |
The affected expression is:
Parallel command and normal-directory branches use #! or #\! as intended.
Reproduction evidence
An isolated local plugin load using nocd and atinit'!typeset -g ZI_AUDIT_ATINIT=ran' produced:
(eval):1: command not found: !typeset
rc=0 marker=unset
Impact
The hook is skipped while the plugin load reports success. Configuration that depends on the hook can remain partially initialized without a reliable failure signal.
Acceptance criteria
- Strip the
! marker consistently in every plugin and snippet load branch.
- Preserve the documented
nocd working-directory behavior.
- Add regression tests for deferred
atinit with and without nocd.
- Verify the hook executes exactly once and the load status is meaningful when it fails.
Next action
Add the focused failing test, then normalize the marker handling with the adjacent branches.
Problem
The normal plugin source path strips the character
1instead of the deferred-hook marker!whennocdis combined withatinit'!...'.Current source:
zi/zi.zsh
Lines 1648 to 1656 in 7956627
The affected expression is:
Parallel command and normal-directory branches use
#!or#\!as intended.Reproduction evidence
An isolated local plugin load using
nocdandatinit'!typeset -g ZI_AUDIT_ATINIT=ran'produced:Impact
The hook is skipped while the plugin load reports success. Configuration that depends on the hook can remain partially initialized without a reliable failure signal.
Acceptance criteria
!marker consistently in every plugin and snippet load branch.nocdworking-directory behavior.atinitwith and withoutnocd.Next action
Add the focused failing test, then normalize the marker handling with the adjacent branches.