From 11bf7ecaa4354c86bd74be3c0c1452089e6d3fd1 Mon Sep 17 00:00:00 2001 From: dissimulo Date: Sun, 17 May 2026 04:02:13 -0700 Subject: [PATCH] zsh: eagerly define diff() to avoid prezto autoload-stub error Pretzo's modules/utility/functions/diff registers an autoload stub that emits '(eval):1: diff: function definition file not found' in non- interactive eval contexts where $fpath doesn't include the utility module's functions directory. Define diff as a real function up front so the stub never has to look itself up. --- zsh/diff.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 zsh/diff.zsh diff --git a/zsh/diff.zsh b/zsh/diff.zsh new file mode 100644 index 00000000..d48421c8 --- /dev/null +++ b/zsh/diff.zsh @@ -0,0 +1,13 @@ +# Eagerly define `diff` as a real function instead of relying on prezto's +# autoload stub. The autoload stub emits +# "(eval):1: diff: function definition file not found" +# in non-interactive eval contexts where $fpath doesn't yet include the +# prezto utility module's functions directory. Defining a real function +# here bypasses the autoload path entirely. +function diff { + if (( $+commands[colordiff] )); then + command diff --unified "$@" | colordiff --difftype diffu + else + command diff --unified "$@" + fi +}