Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Notifications
Mark all as read
Q&A

How to make selection and overwrite from register all from ex mode

+1
−1

MWE

line 1
line 2
line 3
line 4
line 5
line 6
line 7
  1. Go to "line 4": /line 4 ENT.
  2. Delete into register: dd.
  3. Replace everything with register using only ex mode.

Problem

I am uncertain how to proceed with Step 3. I would assume it's something like :-3,+2v | p, with relative line numbering, but that doesn't work.

Notes

I understand in this example you can take the approach of deleting everything but line 4, but that's not what I'm looking for. This is just an example, the use case is more complex.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Unclear question (2 comments)

0 answers

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us! Donate