Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 3.1.6-pws-3: _man



Unless my brain is even softer than usual, manual completion currently
doesn't work with correction and approximation, because it generates
the patterns itself.  This does the trick, but perhaps there is a more
standardised way we could invent.

--- Completion/User/_man.old	Mon Aug 30 13:28:34 1999
+++ Completion/User/_man	Thu Sep  9 11:02:49 1999
@@ -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'

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56100 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author