0

I have this scenario. For example, I have 3 lines of text with following content:

first_line
second_line
third_line

I want to copy text first_line to replace second_line and third_line. So after copy and replace, new content should be:

first_line
first_line
first_line

I do by: press viw for selecting first_line text. Then go to second line, press vi for selecting second_line text, then press p for replacing text.

I repeat again by go to third line. But at this time, text second_line is saved to clipboard automatically (I don't copy it). so when I replace third_line text, new text will be second_line. So new content will be:

first_line
first_line
second_line

This behavior annoys me so much. It makes me cannot copy one content to many places. How can I fix this.

Thanks.

Trần Kim Dự
  • 5,872
  • 12
  • 55
  • 107

1 Answers1

1

I think that at least part of your problem is related to the register being used to store the copied text, so a possible solution is to customize such behavior for IdeaVIM, as indicated in another answer, you can edit your ~/.ideavimrc file and add the following two lines, create that file if it does not exists:

set clipboard+=unnamed
set clipboard+=unnamedplus

I had to restart the IDE for this changes to take effect.

Now I you should be able to paste multiple lines using "+p or "*p see this article for more details.

emont01
  • 3,010
  • 1
  • 22
  • 18