Jeet
Jeet

Reputation: 39807

Put (paste) character-wise yanked text over block-wise visual selection

Is there a way to easily achieve the above?

For e.g., given

red apple
red banana
red cucumber

The fruits are blue.

Is there a way for me to yank the word "blue", then visually-select the column of "red" words and paste so that we get:

blue apple
blue banana
blue cucumber.

The words are blue.

Right now, the first "red" gets replaced and the remaining get cleared.

Upvotes: 2

Views: 215

Answers (2)

Ingo Karkat
Ingo Karkat

Reputation: 172570

My UnconditionalPaste plugin will allow that. Select the block of red, then press gr. All words will be replaced by the previously yanked blue, plus the unnamed register continues to hold blue.

Upvotes: 1

romainl
romainl

Reputation: 196546

When the red column is selected, do the following:

c         " change
<C-r>0    " Ctrl+r followed by 0 inserts the last yanked text (from register 0)
<Esc>     " exit insert mode and apply change to the whole column

Upvotes: 3

Related Questions