From: Bart Schaefer <schaefer@brasslantern.com>
To: Jukka Lehti <jukkalehti@yahoo.com>, zsh-users@sunsite.dk
Subject: Re: Few newbie questions..
Date: Sat, 18 Aug 2001 03:25:13 +0000 [thread overview]
Message-ID: <1010818032514.ZM14858@candle.brasslantern.com> (raw)
In-Reply-To: <20010817173924.73063.qmail@web20304.mail.yahoo.com>
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).
Aha.
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:
mkdir ~/zshfuncs
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:
_man_pages() {
local matcher pages dummy
zparseopts -E M+:=matcher
if (( $#matcher ))
then
matcher=(${matcher:#-M})
matcher="$matcher"
else
matcher=
fi
pages=($dirs)
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:
fpath=(~/zshfuncs $fpath)
Thus your _man file will be found before the installed one, and you'll
see the file suffixes.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
next prev parent reply other threads:[~2001-08-18 3:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-17 10:55 Jukka Lehti
2001-08-17 15:22 ` Bart Schaefer
2001-08-17 17:39 ` Jukka Lehti
2001-08-18 3:25 ` Bart Schaefer [this message]
2001-08-18 8:04 ` Jukka Lehti
2001-08-20 22:34 ` Vincent Lefevre
2001-08-21 2:55 ` Bart Schaefer
2001-08-21 6:27 ` Borsenkow Andrej
2001-08-21 6:38 ` Bart Schaefer
2001-08-20 11:59 ` Jukka Lehti
2001-08-20 12:19 ` Sven Wischnowsky
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=1010818032514.ZM14858@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=jukkalehti@yahoo.com \
--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).