Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does vi's y yank two lines?

Tags:

vi

nyy yanks n lines, which is normal behaviour, but why does y yank two lines while yy yanks one line only?

It sounds rather counterintuitive to me. I wonder what led to this decision. Not sure about vim since I'm using vi for now.

like image 201
user3511965 Avatar asked Nov 02 '25 17:11

user3511965


1 Answers

Single y has to be followed by an operand. Probably what you are doing is pressing 'y' then one of the movement commands 'j' or 'k'. This command also acts as an operand for 'y' so it yanks to lines. Tray yj and yk to see which line gets yanked.

like image 95
Vlad Avatar answered Nov 05 '25 16:11

Vlad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!