8

I have the text

var1=a
var2=aaa
var3=aaaaaa

some text... "" ...
some text... "" ...
some text... "" ...

I want to paste the a-part of the top 3 lines into the quotes in the last 3 line. The result should look like this

some text... "a" ...
some text... "aaa" ...
some text... "aaaaaa" ...

Now using Vim block selection Ctrl+V, selecting block of a til the end of each line using $ and then pasting it into the first "" gives me the wrong result:

some text... "a     " ...
some text... "aaa   " ...
some text... "aaaaaa" ...

As you can see, vim aligns pasted text by adding extra spaces, that I don't need in my case.

Why Vim inserting those spaces and how can I paste my block without those extra spaces get added?

4

Unfortunately, that's the standard behaviour, as far as I know. As detailed in this answer, if you check the contents of your registers via :reg, you'll see the whitespaces between linebreaks and text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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