Saturday, February 07, 2026

Re: vi(1) idiosyncracies

On 2006-09-14 03:23, Bob Beck wrote:
> When I'm a sysadmin and type vi, I want vi with all it's ususal
> idiosyncracies so that it's basically the same no matter what system

Idiosyncracies aside, I'd still like to see it get bug fixes, such as
this one that regularly bites me:

$ yes hello | head -50 | fmt -100 > long_lines.txt
$ vi long_lines.txt
:g/^/.!fmt

results in

+=+=+=+=+=+=+=+
Illegal address: only 6 lines in the file.
Error: unable to retrieve line 7; 4 lines added; 2 lines deleted

instead of re-fmt(1)ing each line individually. Another case involves
duplicating each line in the file:

$ vi
:r !jot 100
:g/^/t.

which produces:

+=+=+=+=+=+=+=+
Illegal address: only 150 lines in the file.
Error: unable to retrieve line 151; 50 lines added

This also ends up duplicating *every other* line, instead of duplicating
*every* line.

-tkc

PS: FWIW, the problem exists in FreeBSD's vi/nvi too:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270048

which I reported there at the same time I reported this on bugs@

https://marc.info/?l=openbsd-bugs&m=167830927129031&w=3

but never heard anything on either front.
--

No comments:

Post a Comment