0

When invoking, say '$ man zshbuiltins' if I want to read up on zsh's 'read' command, using the slash to start a search will give you a hundred hits of the string 'read' before you get to the actual command 'read', and one way to help get directly to the command it to search for " read" because the spaces take to to the actual subsection of the command. However it would be cool if it were possible to do something like that directly from the command line sorta like:

$ man zshbuiltins --search "     read"

... I don't belive it's possible but can someone suggest a way this might be achieved?

Ray Andrews
  • 2,347
  • I couldn't get the suggestion there to work exactly as given, however, tinkering with it, I did find something perfect, see below. – Ray Andrews Oct 04 '22 at 18:28
  • 1
    I'd use info instead of man (you might need to install a zsh-doc package or similar). And do info zsh read (see also i and I within info). – Stéphane Chazelas Oct 04 '22 at 20:41

1 Answers1

1
 $ man zshbuiltins | less -p '^       read' 

... Exactly what I want. Beginning of the line, seven spaces, then the name of the command (read), and it takes you right to the command. Built myself a little function:

$ zhelp() { man zshbuiltins | less -p "^       $1" }
$ zhelp read

... and it takes me right to where I want to go.

Ray Andrews
  • 2,347