I see different pasting behaviour depending on how I yanked a line. I would like to know why.
If I yank a line starting from normal mode:
^v$y
^
to go to the beginning of the line
v
to enter visual mode
$
to go to the end of the line
y
to yank
Then I use p
to paste and it works as expected.
However, when I yank a line starting from normal mode and using visual mode linewise:
Vy
V
to go to visual mode linewise
y
to yank
And then I use p
to paste, I see that the line is pasted below the current line. It is like paste operation is opening a new line first and then pasting there.
Example. Lines at the beginning:
Line1
Line2
Line3. Insert here
I yank Line2 using method 1.
I move the cursor to the dot of Line3 and press p
to paste. I get this result:
Line1
Line2
Line3.Line2
Insert here
But when I do the same thing using yanking method two I get this result:
Line1
Line2
Line3. Insert here
Line2
If the contents of the :registers are the same in both cases why pasting works different?
Edit:
Found the answer here
Even if the register contents are the same; the type of register becomes different depending on the yanking method and different register type makes pasting do a different thing.
Found the answer here
Even if the register contents are the same; the type of register becomes different depending on the yanking method. Register type makes pasting do a different thing.
And you can see the register type for a given register by typing :echo regtype('"')