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

completion control for "man" command


Rather than keeping this mail to myself and trying the impossible [;-)] I'll
forward this to the experts on the zsh-users mailist. Hope you don't mind.
(And I hope it answers your question on a "public forum" for zsh, Johan. :-)

I wonder - hasn't the completion control for manuals been perfected by now?


----- Forwarded message from Johan Sundström <johsu650@xxxxxxxxxxxxxx> -----

From: "Johan Sundström" <johsu650@xxxxxxxxxxxxxx>
To: "Sven Guckes" <guckes@xxxxxxxxxxxxxxxxx>
Subject: Compctl ... -- man
Date: Sat, 13 Jun 1998 20:06:28 +0200
X-Mailer: Microsoft Outlook Express 4.72.3110.1

I've been trying to fix a pleasant completion behaviour for the "man"
command, looking at files in the directories named in the vector $manpath,
in the order they are presented there. I guess I should build some
intelligent for structure that traverses the array and builds up some
intricate compctl commandline that is finally executed, but I'm not sure how
it should be accomplished. Could the -g globbing be used in some clever way?
We're looking at matching files matching a given pattern in a set of
directories, cutting out just a part of the filename path (something like
'(:t:r)' in my figlet setup, although not only cutting away the last
extension but all present; turning "/usr/man/man1/zshcompctl.1.gz" to

Maybe I'm seriously overambitious about this one, but it would be *very*
convenient to have completion for the man command. Perhaps it will take a
bit too long to dive through all these directories everytime the completion
is executed, and thus should be done initially, from .zshrc? Any suggestions
on how to accomplish this?

Is there a public forum somewhere (on the web?), where people announce their
clever compctl completions and similar clever zsh tricks? It would do a
great deal to help newcomers learn and other benefit from eachothers ideas
and cleverness/laziness. :) I've just recently started to learn the sheer
potential for the command, and I can frankly say that I'm amazed. I played
around for a while, and ended up with a cute figlet completion:

compctl -x 'C[-1,-f]' -g '/usr/share/figlet/*.flf(:t:r)' - 'C[-1,-d]' -g
'*(/)' -- figlet

(Sure, it's not perfect; there's no clever -C parameter completion
behaviour, but hey, I'm just a newbie :-)

/Johan Sundström, happy Red Hat Linux user

----- End forwarded message -----

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