1

Say I have a file with the following contents (on a single line):

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed augue ligula, venenatis et orci non, convallis congue nunc. Nam eleifend mauris vehicula enim facilisis, vitae commodo metus eleifend. Vivamus convallis vestibulum lorem, et mattis nisl iaculis nec. Nullam vitae egestas ipsum, in tempus augue. Suspendisse mattis odio in justo ultricies, ac aliquam odio efficitur. Nam libero arcu, mollis blandit sem id, accumsan mattis orci. Nam scelerisque, mi eget sollicitudin bibendum, dui tortor placerat mi, eget tempor arcu odio at lacus. Integer turpis eros, sollicitudin ac risus sit amet, viverra efficitur lectus. Nulla rhoncus nisl eget neque aliquam maximus.

But I've :set wrap linebreak in my .vimrc, so that it appears like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed augue ligula, venenatis et orci non, 
convallis congue nunc. Nam eleifend mauris vehicula enim facilisis, vitae commodo metus eleifend. 
Vivamus convallis vestibulum lorem, et mattis nisl iaculis nec. Nullam vitae egestas ipsum, in 
tempus augue. Suspendisse mattis odio in justo ultricies, ac aliquam odio efficitur. Nam libero 
arcu, mollis blandit sem id, accumsan mattis orci. Nam scelerisque, mi eget sollicitudin bibendum, 
dui tortor placerat mi, eget tempor arcu odio at lacus. Integer turpis eros, sollicitudin ac risus 
sit amet, viverra efficitur lectus. Nulla rhoncus nisl eget neque aliquam maximus.

If I :ye the first word of each (visual) line and paste it into a new file, I get what I'd expect:

Lorem
convallis
Vivamus
tempus
arcu
dui
sit

But if I instead select the first word as a visual block (ctrl + v + l), yank, and paste into a new file, the pasted result is shifted, and appears to include the spaces visually added to the previous line in order to avoid breaking words across lines:

Lorem
   conval
d. V
m, in
 Nam
itu
lic

Is this a bug, or intended behavior? Is there a way to ensure that what I yank corresponds to what I've selected visually?

I'm using Ubuntu 16.04, and am using vim 8.0.606 (built from the github repo).

Your Answer

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

Browse other questions tagged or ask your own question.