zsh-users
 help / color / mirror / code / Atom feed
From: Frank Terbeck <frank.terbeck@rwth-aachen.de>
To: zsh users <zsh-users@sunsite.dk>
Subject: Re: menuselection with manpages
Date: Fri, 19 May 2006 00:09:07 +0200	[thread overview]
Message-ID: <20060518220907.GX7968@fsst.voodoo.lan> (raw)
In-Reply-To: <20060517151015.GK7968@fsst.voodoo.lan>

Frank Terbeck <frank.terbeck@rwth-aachen.de>:
> I'm using completion for the 'man' command with menuselection (sorted
> by sections). Now, if I enter 'man cron<TAB>' I am dropped into a
> selection for crontab(1) crontab(5) and cron(8).
[...]
> How would I get the completion to add the section to the completion,
> like 'man 5 crontab'?

Hi.
I found some time this evening, so I played around with the _man
function a little bit. The required change was pretty simple:

[snip]
--- _man.old    2006-05-18 23:46:40.000000000 +0200
+++ _man        2006-05-18 23:44:57.000000000 +0200
@@ -90,7 +90,7 @@
   # beginning with .<->: that handles problem cases like files called
   # `POSIX.1.5'.
 
-  compadd "$@" - ${pages%.(?|<->*(|.gz|.bz2|.Z))}
+  compadd "$@" -P "$sect " - ${pages%.(?|<->*(|.gz|.bz2|.Z))}
 }
 
 _man "$@"
[snap]

This works pretty nice, however, if you do this:

  % man 5 cront<TAB>

it expands to:

  % man 5 5 crontab

which is not what I would want. How could I get this to work sanely?
As in: Only add the section if none was specified.

Regards, Frank


  reply	other threads:[~2006-05-18 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-17 15:10 Frank Terbeck
2006-05-18 22:09 ` Frank Terbeck [this message]
2006-05-19  3:28   ` Bart Schaefer
2006-05-19  4:38     ` Frank Terbeck
2006-05-19  8:31   ` Oliver Kiddle
2006-05-20  8:10     ` Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060518220907.GX7968@fsst.voodoo.lan \
    --to=frank.terbeck@rwth-aachen.de \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).