diff options
Diffstat (limited to 'Functions/Misc/run-help')
-rw-r--r-- | Functions/Misc/run-help | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help index a8109e3ea..4f447b9f0 100644 --- a/Functions/Misc/run-help +++ b/Functions/Misc/run-help @@ -11,16 +11,19 @@ emulate -R zsh setopt localoptions +[[ $1 == "." ]] && 1="dot" +[[ $1 == ":" ]] && 1="colon" + # Check whether Util/helpfiles has been used to generate zsh help -if [[ $1 == "-l" ]] +if [[ $# == 0 || $1 == "-l" ]] then - if [[ -n "${HELPDIR:-}" ]] + if [[ -n "${HELPDIR:-}" && -d $HELPDIR ]] then - echo 'Here is a list of topics for which help is available:' + echo "Here is a list of topics for which special help is available:" echo "" print -rc $HELPDIR/*(:t) else - echo 'There is no list of help topics available at this time' + echo "There is no list of special help topics available at this time." fi return 0 elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]] @@ -29,7 +32,7 @@ then return $? fi -# No zsh help, use "whence" to figure out where else we might look +# No zsh help; use "whence" to figure out where else we might look local what places newline=' ' integer i=0 didman=0 @@ -45,21 +48,34 @@ do [[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t} ;; (*( is a * function)) - builtin functions ${what[(w)1]} | ${=PAGER:-more} - ;; + case ${what[(w)1]} in + (comp*) man zshcompsys;; + (zf*) man zshftpsys;; + (*) builtin functions ${what[(w)1]} | ${=PAGER:-more};; + esac;; (*( is a * builtin)) case ${what[(w)1]} in (compctl) man zshcompctl;; - (bindkey) man zshzle;; + (comp*) man zshcompwid;; + (bindkey|vared|zle) man zshzle;; (*setopt) man zshoptions;; + (cap|getcap|setcap) ;& + (clone) ;& + (ln|mkdir|mv|rm|rmdir|sync) ;& + (sched) ;& + (stat) man zshmodules;; + (zftp) man zshftpsys;; (*) man zshbuiltins;; esac ;; (*( is hashed to *)) man ${what[(w)-1]:t} ;; + (*( is a reserved word)) + man zshmisc + ;; (*) - ((! didman++)) && man $1 + ((! didman++)) && man $@ ;; esac if ((i < $#places && ! didman)) |