0

Suppose we have something like,

here is some text.
here is some more text.
here is.
here is some.

Starting with gg 0, how do I do something like v t. 4j so that I can replace text up to a . on each line?

1 Answer 1

2

What you want is to replace the text, not select it

1,4normal! ct.Whatever
6
  • Suppose I want to copy the text. Then 1,4normal! yt. just copies the last line (well, I guess it copies each line 1 through 4, but doesn't store them as it would when yanking a visual block). The reason I was trying to select is so that I know what I am operating on.
    – algae
    Jun 3, 2020 at 5:45
  • @algae Vim doesn't support arbitrary visual selection. You can search for some "crutch"-plugin (vim-multiple-cursors or whatever they call it).
    – Matt
    Jun 3, 2020 at 6:42
  • Thanks. Strange you can't copy it without visual selection though.
    – algae
    Jun 3, 2020 at 7:00
  • @algae Why not? 1,4normal! "Ayt.
    – Matt
    Jun 3, 2020 at 7:14
  • Okay, but no new lines.
    – algae
    Jun 3, 2020 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.