diff options
-rw-r--r-- | Completion/User/_man | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Completion/User/_man b/Completion/User/_man index 049fa7db7..ebe9a432e 100644 --- a/Completion/User/_man +++ b/Completion/User/_man @@ -2,12 +2,23 @@ setopt localoptions rcexpandparam -local rep expl +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]}/$PREFIX*$SUFFIX.<->*(N:t:r) ) + rep=( + $manpath/(man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) ) else - rep=( $manpath/(man|cat)*/$PREFIX*$SUFFIX.<->*(N:t:r) ) + rep=( $manpath/(man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) ) fi _description expl 'manual page' |