On Mon, Mar 02, 2020 at 11:49:31AM +0100, Marc Chantreux wrote:
> hello,
>
> coming from linux, i'm used to read manpages
> in a vi buffer so i can do much more than
> reading the content. i basically use
>
> :r !man ls
> or
> !!sh (when the line content is "man ls")
>
> under openbsd, it seems man doesn't if stdout
> is a tty. i digged the man manual a little bit
> without finding a solution so i worked the
> things around:
Try the mandoc manual page, man is just a front-end to it. Both
man/mandoc support -T option and you can specify ascii/utf8 to get the
formatted page but it still adds all escape sequences. The documentation
says to pipe the output to col -b to suppress them (I think what you did
with the alternative fmt command).
There is an interesting markdown output that seems to work a little bit
better in your case.
Example: :r!man -T markdown ls
But it still not raw.
> :r !man ls|fmt
To be honest, I think the easiest in that case is to simply add an
alias/helper in your shell like viman:
#!/bin/sh
man "$@" | col -b
In vim: :r!viman ls
Tested, it worked like a charm.
HTH,
--
David