Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: menuselection with manpages
- X-seq: zsh-users 10279
- From: Frank Terbeck <frank.terbeck@xxxxxxxxxxxxxx>
- To: zsh users <zsh-users@xxxxxxxxxx>
- Subject: Re: menuselection with manpages
- Date: Fri, 19 May 2006 00:09:07 +0200
- In-reply-to: <20060517151015.GK7968@xxxxxxxxxxxxxxx>
- Mail-followup-to: zsh users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Operating-system: Linux 2.6.16.1 i686
- References: <20060517151015.GK7968@xxxxxxxxxxxxxxx>
Frank Terbeck <frank.terbeck@xxxxxxxxxxxxxx>:
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author