Zsh Mailing List Archive
Messages sorted by:
Re: Few newbie questions..
- X-seq: zsh-users 4135
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Jukka Lehti <jukkalehti@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: Few newbie questions..
- Date: Sat, 18 Aug 2001 03:25:13 +0000
- In-reply-to: <20010817173924.73063.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20010817173924.73063.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
On Aug 17, 10:39am, Jukka Lehti wrote:
} When I type for example 'man local' and hit tab
} I can choose from:
} locale.1 locale.3 locale.7
} I prefer the man completion to show me the section
} numbers (although I have remove the number before
} pressing enter since man can't find e.g. locale.1).
Before I go any further, I'll mention that with `compinit' zsh 4 is able
to complete only those pages that are available in a particular section,
so you can do e.g.
zsh% man 7 lo<TAB>
and see only the pages that are in section 7. I realize this is sort of
the inverse of what you were asking, but maybe it's of interest.
OK, moving on. You must be using `compinit' or the compctl that you
described would still be working. So you need to change the way that
the existing completion function adds matches. Assuming that you have
4.0.2 (it changed since 4.0.1) the following should fix you up.
First, make a copy of the _man function definition:
cp $^fpath/_man(|)(N) ~/zshfuncs
The (|)(N) silliness is just to ignore the directories in $fpath where
there is no _man file. Look up "glob qualifiers" in the manual.
Edit ~/zshfuncs/_man to change the _man_pages helper function (which is
also defined in the _man file) as shown below:
local matcher pages dummy
zparseopts -E M+:=matcher
if (( $#matcher ))
compfiles -p pages '' '' "$matcher" '' dummy '*'
pages=($~pages(:t)) # CHANGED
(($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd))
compadd "$@" -a pages # CHANGED
That fixes _man_pages so as to keep the file suffixes when adding the
completions. It'll have to be updated if _man changes again in another
zsh release, but it's the best that can be done in the circumstances.
Then, in your .zshrc somewhere -after- you call `compinit', add:
Thus your _man file will be found before the installed one, and you'll
see the file suffixes.
Bart Schaefer Brass Lantern Enterprises
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by: