← Back to context

Comment by zahlman

5 days ago

> It would be amazing if there were some kind of universal system to make it easy to look up a specific option in a man page (“what does -a do?”). The best trick I know is use the man pager to search for something like ^ *-a but I never remember to do it and instead just end up going through every instance of -a in the man page until I find what I’m looking for.

Maybe what we need is a better man page reader?

I have played with that idea for a while until I realized I was creating a poor man's web browser in the terminal.

At that point I started wondering if converting my man folder to HTML and using lynx[1] wasn't a better idea.

I ended up using vanilla man again.

Are there better/fancier manpage readers out there that can change my mind?

[1]: https://lynx.invisible-island.net/current/

  • I tend to read man pages in Emacs, which comes with a 'man' command (invoking that executable) and a 'woman' command (an alternative implemented entirely within Emacs), which both implement a basic amount of hyperlinking in their display. For example, I just tried it with the 'rg' manual (first suggestion when I ran `man`), which says:

    > Like other tools such as ls, ripgrep will alter its output

    That `ls` is marked-up, so pressing RET on it will open the manual for the `ls` command; which includes:

    > FORMAT is interpreted like in date(1).

    Again, that `date` is marked up, so pressing RET on it `date` will open the manual for the `date` command; etc.

    It's obviously just going on heuristics though; e.g. the `ls` manual has marked-up the `--sort` option, and if I hit RET on that it takes me to the manual for the `sort` command ;-)

  • Back in the day, there was Tkman, a GUI manpage reader written in Tcl/Tk. It actually used rman (for Rosetta man) that transformed the roff man sources to a more expressive format.

I've always been baffled why we just hand the man pages over to a normal pager rather than something that actually understands their structure. That "look up a flag" case is exactly what bothers me constantly when viewing man pages. And the search they say they should be using doesn't even work consistently since the flag might not be the first non-whitespace thing on a line if there's aliases.