Index | Thread | Search

From:
Christian Schulte <cs@schulte.it>
Subject:
Re: Another vi(1) paste improvement (Rationale)
To:
Walter Alejandro Iglesias <wai@roquesor.com>
Cc:
tech@openbsd.org, Todd.Miller@sudo.ws
Date:
Wed, 3 Sep 2025 02:24:06 +0200

Download raw body.

Thread
Am 01.09.2025 um 12:29 schrieb Walter Alejandro Iglesias:
> I received a private message from someone arguing that he needs vi(1) to
> be compatible, bug for bug, with all versions of nvi on all operating
> systems.
I second that.

>  One	<- First put your cursor here and hit '3yy'
>  Two
>  Three <- Then, put your cursor here and hit 'p' several times
>  	   consecutively (without manually repositioning the cursor
>  	   between each 'p'.)
>
> The result:
>
>  One
>  Two
>  Three
>  One	<- The cursor lands here the first time
>  One	<- The cursor lands here the second time (and so on)
>  Two
>  Three
>  Two
>  Three

Double checked this with vim under Linux. It behaves the same way there.

> To test *cursor* mode pasting just yank some word (eg "Hello")
> with'ye' and hit 'p' several times.

That one as well.

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Feb 16 2025 05:23:41)

For your first example, you could easily type

3yy0Gp0Gp0Gp0Gp

or more precisely

3yy3^dp3^dp3^dp

For your second example, just type $ in between. Even if the automatic
cursor positioning seems unintuitive today, great care must be taken
changing anything of that. For example. Remember these guys from this
video [1] at timestamp 7:19? No monitors. What seems to not make sense
today, may well have been done intentionally decades ago, or just was
not possible technically. See this video for how much time a cursor
movement can take. Let alone no way to delete characters. There is also
a video somewhere from a guy running an ed(1) session on such a device.
Could not find it directly. So I just want to remind you that calling
something a bug today, may have been a sane decision back then, when
every key stroke took an awful lot of time. Seriously. Keep the cursor
where you put it. Moving that thing automatically somewhere else may
appear counter productive for someone else.

[1] <https://www.youtube.com/watch?v=2XLZ4Z8LpEE>

-- 
Christian