* PATCH: 3.1.6-pws-3: _man
@ 1999-09-09 9:44 Peter Stephenson
1999-09-09 11:21 ` Tanaka Akira
0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 1999-09-09 9:44 UTC (permalink / raw)
To: Zsh hackers list
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@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56100 Pisa, Italy
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: 3.1.6-pws-3: _man
1999-09-09 9:44 PATCH: 3.1.6-pws-3: _man Peter Stephenson
@ 1999-09-09 11:21 ` Tanaka Akira
0 siblings, 0 replies; 2+ messages in thread
From: Tanaka Akira @ 1999-09-09 11:21 UTC (permalink / raw)
To: Zsh hackers list
This is another patch for _man to handle gzipped and/or SGML manual.
Index: Completion/User/_man
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_man,v
retrieving revision 1.1.1.6
diff -u -F^( -r1.1.1.6 _man
--- _man 1999/09/09 09:47:08 1.1.1.6
+++ _man 1999/09/09 11:19:28
@@ -1,6 +1,6 @@
#compdef man
-setopt localoptions rcexpandparam
+setopt localoptions rcexpandparam extendedglob
local rep expl star approx
@@ -14,12 +14,14 @@
approx="(#a${_comp_correct})"
fi
+# `sman' is the SGML manual directory for Solaris 7.
+
if [[ $words[2] = (<->*|ln) ]]; then
rep=(
- $manpath/(man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) )
+ $manpath/(sman|man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t) )
else
- rep=( $manpath/(man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) )
+ rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t) )
fi
_description expl 'manual page'
-(( $#rep )) && compadd "$expl[@]" - $rep
+(( $#rep )) && compadd "$expl[@]" - ${rep%%.[^.]##(.gz|)}
--
Tanaka Akira
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-09-09 11:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-09 9:44 PATCH: 3.1.6-pws-3: _man Peter Stephenson
1999-09-09 11:21 ` Tanaka Akira
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).