mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-02 06:40:55 +01:00
25 lines
626 B
Text
25 lines
626 B
Text
#compdef man
|
|
|
|
setopt localoptions rcexpandparam
|
|
|
|
local rep expl star approx
|
|
|
|
if [[ $compstate[pattern_match] != [^*] ]]; then
|
|
# If a string other than *, we just want correction, so no `*'.
|
|
star='*'
|
|
fi
|
|
|
|
if [[ -n $_comp_correct ]]; then
|
|
# If this is set, we are correcting with this many approximations.
|
|
approx="(#a${_comp_correct})"
|
|
fi
|
|
|
|
if [[ $words[2] = (<->*|ln) ]]; then
|
|
rep=(
|
|
$manpath/(man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) )
|
|
else
|
|
rep=( $manpath/(man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) )
|
|
fi
|
|
|
|
_description expl 'manual page'
|
|
(( $#rep )) && compadd "$expl[@]" - $rep
|