zsh-users
 help / color / Atom feed
* Separate sections for manuals: what am I missing?
@ 2020-04-06  0:26 Dave Woodfall
  2020-04-06  1:00 ` Bart Schaefer
  2020-04-06  1:02 ` dana
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Woodfall @ 2020-04-06  0:26 UTC (permalink / raw)
  To: zsh-users

I have separate sections and group-name set:

zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*' group-name ''

And I see the sections just fine:

% man printf<tab>
 ---- manual page, section 1 (general commands)
 printf
 ---- manual page, section 3 (library functions)
 printf
 ---- manual page, section 3p (library functions [POSIX])
 printf

However, selecting any section manual will always gets the first
section manual listed.

Do I need to add some other option so that I get can get e.g.
printf(3)?

I'm using man-db if it makes any difference.

Thanks

--
Dave

< The antibloat squad! >
< For those interested in no bloat, minimal desktop Linux >
< gopher://tty1.uk/1/?minimal-linux >
< http://tty1.uk/minimal-linux >
< #minimallinux @ chat.freenode.net >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Separate sections for manuals: what am I missing?
  2020-04-06  0:26 Separate sections for manuals: what am I missing? Dave Woodfall
@ 2020-04-06  1:00 ` Bart Schaefer
  2020-04-06  1:02 ` dana
  1 sibling, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2020-04-06  1:00 UTC (permalink / raw)
  To: Zsh Users

On Sun, Apr 5, 2020 at 5:27 PM Dave Woodfall <dave@tty1.uk> wrote:
>
> Do I need to add some other option so that I get can get e.g.
> printf(3)?

Completion operates on a single word under normal circumstances.  In
order to get the manual from section 3, you have to place the section
number in the word preceding the one you are currently completing.
Although it's not impossible to get completion to insert "3 printf" or
"--sections=3 printf", that's replacing one word with two, which
potentially messes up menu completion etc. later.  That is, pressing
TAB repeatedly won't do what you expect any longer.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Separate sections for manuals: what am I missing?
  2020-04-06  0:26 Separate sections for manuals: what am I missing? Dave Woodfall
  2020-04-06  1:00 ` Bart Schaefer
@ 2020-04-06  1:02 ` dana
  2020-04-06  1:14   ` Dave Woodfall
  1 sibling, 1 reply; 6+ messages in thread
From: dana @ 2020-04-06  1:02 UTC (permalink / raw)
  To: Dave Woodfall; +Cc: Zsh Users

On 5 Apr 2020, at 19:26, Dave Woodfall <dave@tty1.uk> wrote:
> However, selecting any section manual will always gets the first
> section manual listed.
>
> Do I need to add some other option so that I get can get e.g.
> printf(3)?

I think you want insert-sections. I guess it's not actually in the
documentation (i'll add it later), but the tag takes the form manuals.<sect>,
where <sect> is a pattern matching the section(s) you want to insert. So you
can just do this if you want to insert all sections:

  zstyle ':completion:*:manuals.*' insert-sections true

This also seems popular (insert all sections but 1):

  zstyle ':completion:*:manuals.^1' insert-sections true

dana


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Separate sections for manuals: what am I missing?
  2020-04-06  1:02 ` dana
@ 2020-04-06  1:14   ` Dave Woodfall
  2020-04-06  1:45     ` dana
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Woodfall @ 2020-04-06  1:14 UTC (permalink / raw)
  To: zsh-users

On 2020-04-05 20:02,
dana <dana@dana.is> put forth the proposition:
> On 5 Apr 2020, at 19:26, Dave Woodfall <dave@tty1.uk> wrote:
> > However, selecting any section manual will always gets the first
> > section manual listed.
> >
> > Do I need to add some other option so that I get can get e.g.
> > printf(3)?
>
> I think you want insert-sections. I guess it's not actually in the
> documentation (i'll add it later), but the tag takes the form manuals.<sect>,
> where <sect> is a pattern matching the section(s) you want to insert. So you
> can just do this if you want to insert all sections:
>
>   zstyle ':completion:*:manuals.*' insert-sections true

Thanks, that solves it.  One question though: Is it possible to tell
when you're in a manual select menu?  I suppose I could test if the
first word is `man'.

--
Dave

The antibloat squad!
For those interested in no bloat, minimal desktop Linux
gopher://tty1.uk/1/?minimal-linux
http://tty1.uk/minimal-linux
#minimallinux @ chat.freenode.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Separate sections for manuals: what am I missing?
  2020-04-06  1:14   ` Dave Woodfall
@ 2020-04-06  1:45     ` dana
  2020-04-06  5:26       ` Dave Woodfall
  0 siblings, 1 reply; 6+ messages in thread
From: dana @ 2020-04-06  1:45 UTC (permalink / raw)
  To: Dave Woodfall; +Cc: Zsh Users

On 5 Apr 2020, at 20:14, Dave Woodfall <dave@tty1.uk> wrote:
> Thanks, that solves it.  One question though: Is it possible to tell
> when you're in a manual select menu?  I suppose I could test if the
> first word is `man'.

I'm not sure what you mean. In what context / for what purpose?

dana


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Separate sections for manuals: what am I missing?
  2020-04-06  1:45     ` dana
@ 2020-04-06  5:26       ` Dave Woodfall
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Woodfall @ 2020-04-06  5:26 UTC (permalink / raw)
  To: zsh-users

On 2020-04-05 20:45,
dana <dana@dana.is> put forth the proposition:
> On 5 Apr 2020, at 20:14, Dave Woodfall <dave@tty1.uk> wrote:
> > Thanks, that solves it.  One question though: Is it possible to tell
> > when you're in a manual select menu?  I suppose I could test if the
> > first word is `man'.
>
> I'm not sure what you mean. In what context / for what purpose?

My trick of setting LINES to limit how many menu lines are printed
messes up the prompt line if I press tab at the end of a line after a
section number has been inserted, the text on the line is repeated:

% man 3 printf an 3 printf
               ^

With the cursor on the A above the hat.  However, doing a zle -R in
my custom complete function fixes it.

--
Dave

The antibloat squad!
For those interested in no bloat, minimal desktop Linux
gopher://tty1.uk/1/?minimal-linux
http://tty1.uk/minimal-linux
#minimallinux @ chat.freenode.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06  0:26 Separate sections for manuals: what am I missing? Dave Woodfall
2020-04-06  1:00 ` Bart Schaefer
2020-04-06  1:02 ` dana
2020-04-06  1:14   ` Dave Woodfall
2020-04-06  1:45     ` dana
2020-04-06  5:26       ` Dave Woodfall

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git