zsh/theme.zsh: restore prezto fpath before loading skwp prompt
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user