Marek Wawrzos
Marek Wawrzos

Reputation: 336

Paste as in replace mode

I got used to indent my code in such way:

  asd          sthng
  asd someText sthng

I would like to paste something in the space in the first line. I would like to keep indention also.

Result of pasting:

  asd pstdText sthng
  asd someText sthng

Is there a way in VIM to paste a text in a way how replace mode (R) works?

Upvotes: 6

Views: 1363

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172510

You can enter replace mode with R and then insert the contents of the register via <C-R>".

Alternatively, if you select the amount of text that corresponds to the to-be-pasted text (or there's a motion that covers such), you can use my UnconditionalPaste plugin to replace the selection with the register (without losing the register contents).

Upvotes: 9

Related Questions