Hi All,
Prompted by a Unix StackExchange question, I started a mini project
called mnpgr a few days ago. It's in a very usable state now.
This is glue code, written in TXR Lisp which turns Vim into a
page for reading man pages.
Plus, a small Vim syntax filee.
https://www.kylheku.com/cgit/mnpgr/about/
The benefits are
- Remembers your last position in any man page. This is useful for
working with long man pages.
- Leverages your Vim skills and environment.
- Has better rendering of backspace overstrikes than the "less" utility.
For instance, it correctly renders the French accented characters
exemplified in the GNU grep man page.
- bold+italic is recognized and assigned to its own highlight
category.
The program translates man's overstrikes into its own markup notation;
for instance, bold text is {B{bold text}B}. The Vim syntax file hides
the markup and colorizes the payload.
On 15.10.2023 02:46, Kaz Kylheku wrote:
Hi All,
Prompted by a Unix StackExchange question, I started a mini project
called mnpgr a few days ago. It's in a very usable state now.
This is glue code, written in TXR Lisp which turns Vim into a
page for reading man pages.
Plus, a small Vim syntax filee.
https://www.kylheku.com/cgit/mnpgr/about/
The benefits are
- Remembers your last position in any man page. This is useful for
working with long man pages.
- Leverages your Vim skills and environment.
- Has better rendering of backspace overstrikes than the "less" utility.
For instance, it correctly renders the French accented characters
exemplified in the GNU grep man page.
- bold+italic is recognized and assigned to its own highlight
category.
The program translates man's overstrikes into its own markup notation;
for instance, bold text is {B{bold text}B}. The Vim syntax file hides
the markup and colorizes the payload.
I don't think I'll use 'txr', but your post made me think about the
task...
If 'vim' is your pager you could do
man ... | vim -
:set syntax=man will also do some (predefined) highlighting. While in
Vim you can of course not only remember the "last position" (there's
the default mark, a single quote, for that) but you can also define
arbitrary marks and, of course, randomly jump between them. Or split
the screen to see more than one man page context. You can also (e.g.)
extract portions of the man page. Do whatever an editor supports.
A reason against using an editor is probably the size consideration.
What doesn't seem to work nicely is setting the pager to vim
PAGER='vim -' man ...
Prompted by a Unix StackExchange question, I started a mini project
called mnpgr a few days ago. It's in a very usable state now.
This is glue code, written in TXR Lisp which turns Vim into a
page for reading man pages.
- Leverages your Vim skills and environment.
- Has better rendering of backspace overstrikes than the "less" utility.
In comp.unix.shell, Kaz Kylheku <864-117-4973@kylheku.com> wrote:
Prompted by a Unix StackExchange question, I started a mini project
called mnpgr a few days ago. It's in a very usable state now.
mnpgr: 8270e33c0a820ccb14c1cc6b97460db0a5748f0a
txr: bf5a4cbe020b6726e8f9cef4cd935861442541cf
$ mnpgr perl
/home/username/bin/mnpgr:72: syntax error
This is glue code, written in TXR Lisp which turns Vim into a
page for reading man pages.
Turns out txr is a lot more work to install than mnpgr.
On 2023-10-15, Eli the Bearded <*@eli.users.panix.com> wrote:
$ mnpgr perlIf you remove the .tl suffix, you have to use "txr --lisp" on it,
/home/username/bin/mnpgr:72: syntax error
or else the "txrlisp" alternative executable name (hard link).
Otherwise it's treated as different language.
The mnpgr.tl program takes no arguments and is not meant to be invoked directly by the user (so you don't achieve any ergonomics by dropping
the suffix).
It is invoked by man, and expects to find the MAN_PN environment
variable set up by man.
It only works particular man implementation used on GNU/Linux systems;
the one maintained by Colin Watson.
./configure && make && make install # "make tests" is recommended.
The dependencies are low and optional. If the configure script deosn't
detect header files for libz and libffi, you get a build without them.
{B{SYNOPSIS}B}
{B{man}B} [{I{man options}I}] [[{I{section}I}] {I{page}I} ...] ...
$ MANPAGER=mnpgr man ./txr.1
Hangs for ~30 seconds before showing me the 62828L manpage.
Also: MAN_PN is a poorly documented feature that exists only in some implementations of 'man'. I don't get it set on NetBSD, for example.
You forgot the 25M git clone.
Also I set a prefix for the install. It
took a while to build, I didn't time out, and make install errored out (harmlessly it seems):
$ make install
cp: cannot stat 'stdlib/*.tlo': No such file or directory
contemplating attempting to rewrite the .tl file in perl
In comp.unix.shell, Kaz Kylheku <864-117-4973@kylheku.com> wrote:
If you type ":syntax on" does anything happen, or still no?
E484: Can't open file /usr/local/share/vim/syntax/syntax.vim
The 'configure' tool told me to "make tests and "make install" so that's
what I did. I thought that the tests target would include all of
components of the default target. Is that not so?
On 2023-10-16, Eli the Bearded <*@eli.users.panix.com> wrote:
{B{SYNOPSIS}B}
{B{man}B} [{I{man options}I}] [[{I{section}I}] {I{page}I} ...] ...
OK, so that part of it is working fine. We know man is invoking
mnpgr, which is doing the filtering and running Vim
If you type ":syntax on" does anything happen, or still no?
Do you uget syntax highlighting automatically when opening files?
(The background is white---my eyes!---and word wrap is on, which
screws up some lines: :set nowrap is needed.)
For me, it comes up in about 7 seconds on a really slow, low-end Core
i5-3570 machine from 2012.
(Not to mention that it won't work with NetBSD's vi implementation, ha!)
You forgot the 25M git clone.I think that could be smaller if you don't need the history going back
to 2009, using "git clone --depth <number-of-commits>".
There is a way to pull a tarball also from the cgit.
$ make install
Unfortunately, "make install" does not build everything. You have to run "make" to build the default target.
On 2023-10-15, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
If 'vim' is your pager you could do
man ... | vim -
:set syntax=man will also do some (predefined) highlighting. While in
The problem is that vim will not remember the position in a buffer that
had been read from a pipe. This whole thing was prompted by someone
trying to solve that problem. They wanted to remember the position in
each individual man page. That resonated with me because there have been times when I wanted to revisit something I recently read in a man page.
(One such situation is when I'm working *on* a man page, making
adjustments to some section and wanting to see their effect!)
A reason against using an editor is probably the size consideration.
I tried it on a 13-year-old Core i5, slow machine, on the txr man page,
which is 65000 lines. There is a bit of a delay, but otherwise it's
fine.
Hi All,
Prompted by a Unix StackExchange question, I started a mini project
called mnpgr a few days ago. It's in a very usable state now.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 498 |
Nodes: | 16 (2 / 14) |
Uptime: | 32:00:59 |
Calls: | 9,798 |
Calls today: | 17 |
Files: | 13,751 |
Messages: | 6,188,910 |