Fix zle-line-init error when connecting via SSH

Guard zle -N widget registration behind function existence checks,
since oh-my-zsh plugins that define these functions may not be loaded
yet depending on shell init order (e.g. over SSH).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-07 18:44:29 -04:00
parent cb5a812242
commit 14219cda27

View File

@@ -125,9 +125,9 @@ autoload -Uz add-zsh-hook
add-zsh-hook preexec adlee_preexec add-zsh-hook preexec adlee_preexec
add-zsh-hook precmd adlee_precmd add-zsh-hook precmd adlee_precmd
# Configure ZLE # Configure ZLE (only register widgets if the functions exist, e.g. from vi-mode plugin)
zle -N zle-line-init (( ${+functions[zle-line-init]} )) && zle -N zle-line-init
zle -N zle-keymap-select (( ${+functions[zle-keymap-select]} )) && zle -N zle-keymap-select
# Initial prompt build (critical for tmux) # Initial prompt build (critical for tmux)
_adlee_build_prompt _adlee_build_prompt