From 4cbb4642bb9c4f06fbc6729ecf2995e498cf3d61 Mon Sep 17 00:00:00 2001 From: Marlon Richert Date: Wed, 2 Jun 2021 21:22:59 +0300 Subject: [PATCH] Let run-help try to show function source from file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …because parsed functions don't contain comments. --- Functions/Misc/run-help | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help index e351dd6a6..b5e692198 100644 --- a/Functions/Misc/run-help +++ b/Functions/Misc/run-help @@ -69,7 +69,18 @@ do (comp*) man zshcompsys;; (zf*) man zshftpsys;; (run-help) man zshcontrib;; - (*) builtin functions ${what[(w)1]} | ${=PAGER:-more};; + ( * ) + local func=$what[(w)1] + + # Try to show function source from file, because parsed functions + # don't contain comments. + autoload +X -Uz $func + if [[ -n $functions_source[$func] ]]; then + ${=PAGER:-more} -- $functions_source[$func] + else + builtin functions $func | ${=PAGER:-more} + fi + ;; esac;; (*( is a * builtin)) case ${what[(w)1]} in -- 2.30.1 (Apple Git-130)