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

Re: 'man' completion



On Aug 28,  6:42pm, Sven Guckes wrote:
> Subject: Re: 'man' completion
>
> Quoting Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx):
> > The only missing bit being that if you want to use the section
> > number to restrict the search (i.e. "man 5 x<TAB>" completes only
> > to "xferlog" and not to "xterm" etc.), then you need a function.
> 
> Such as?  ;-)

Uhh, such as

function complete_man_in_section {
  emulate -R zsh
  setopt localoptions nullglob
  local args
  read -Ac args
  args=(${args:#-*})	# Delete all words beginning with "-"
  reply=(${(s(:))^MANPATH}/man$args[2]/*.([1-9nlo]|[1-9](|[a-z]))(:t:r))
}

> I presume there must be some non-plus-ultra completion control for "man".
> But which *is* the best?
> 
> Sven  [hoping to see more of this on this maillist]

There have been more different "man" completions posted to zsh mailing lists
than any other sample completion.  Look through the archives on www.zsh.org.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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