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

man page completion (was Re: Few newbie questions..)



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).

Having the section number visible is a useful idea which I'd also like.
Putting it in the actual match is not ideal though. It would be better
to have the section number in a description or to group different
sections separately under different headings.

I expect some people would prefer not to have this separate grouping.
`zstyle ':completion:*:man.*' group-name manual' might group them all
together but you would then still get separate headings for each group
and I'm not sure if it is possible to replace them with one. It would
also allow other things like use of the tag-order style.

To get this working, it needs something like this:
  sects=( ${pages:e} )
  typeset -U $sects
  for sect in $sects; do
    _wanted "man.$sect" expl "manual page, section $sect" \
        compadd "$@" - ${${(M)pages:#*.${sect}}%.(?|<->*)}
  done

Bart Wrote:
> On Aug 18, 11:00pm, Peter Stephenson wrote:
> } Probably _man_pages and a few others should get the treatment meted out
> } to helper functions in _cvs, namely defining the function only if
> } $functions[_man_pages] is not defined.
> 
> Actually, I don't like the treatment of the functions in _cvs.  It makes
> it very difficult to reload the entire file, which I have occasionally
> wanted to do.

Yes, it can be a nuisance to reload the completion functions which
define other functions. I don't see why it is necessary with _man as
_man_pages is called once, as the last line in _man. The _wanted could
be used directly on compadd.

Oliver

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp



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