From 45fc664976ffdabae68a61212cfd37cc1ef9c7b8 Mon Sep 17 00:00:00 2001 From: dissimulo Date: Tue, 21 Apr 2026 08:17:21 -0700 Subject: [PATCH] zsh/theme.zsh: restore prezto fpath before loading skwp prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The skwp prompt's precmd calls git-info and ruby-info (prezto module functions that live in ~/.zprezto/modules/{git,ruby}/functions). On interactive shell startup, something — likely compinit's insecure-directory pruning when parent dirs are group-writable — strips those paths from $fpath after pmodload seeded them. When precmd then references the autoload-declared-but-unfindable functions, zsh fails to locate the definition file, aborts the prompt render midway through, and zsh-syntax-highlighting latches onto the broken half-prompt. Observed symptoms: prompt_skwp_precmd: git-info: function definition file not found prompt_skwp_precmd: ruby-info: function definition file not found zsh: bad math expression: operand expected at '%F{135}%n%...' _zsh_highlight_call_widget:2: bad math expression: operand... Defensive re-seed: before calling 'prompt skwp', prepend the helper, git, and ruby module function dirs to $fpath if they aren't already present. Idempotent, cheap, and masks any upstream stripping regardless of cause. --- zsh/theme.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zsh/theme.zsh b/zsh/theme.zsh index 50e7eee4..b55d4a54 100644 --- a/zsh/theme.zsh +++ b/zsh/theme.zsh @@ -1 +1,15 @@ +# Re-add prezto module function paths to $fpath. Some flows (compinit's +# insecure-directory check, group-writable home dirs) can strip these, +# which leaves skwp's precmd calling autoload-declared-but-unfindable +# functions like git-info/ruby-info, producing +# "zsh: bad math expression: operand expected at '%F{135}%n%...'" +# and cascading errors in zsh-syntax-highlighting. +() { + local module dir + for module in helper git ruby; do + dir="${ZDOTDIR:-$HOME}/.zprezto/modules/$module/functions" + [[ -d $dir && ${fpath[(I)$dir]} -eq 0 ]] && fpath=($dir $fpath) + done +} + prompt skwp