The first time I use 2V, Vim selects 2 lines in a visual block, as I would expect. When I clear the selection and do 2V again, it again selects 2 lines. Cool.
But when I do 2V, then yank with y, the next 2V will select 4 lines. If I keep alternating between 2V and y, the 2V will double the number of lines selected each time.
Why does this happen? I'm assuming it has something to do with registers, but I can't find a straight answer... why would the contents of a register affect V?
This is special behavior in vim. It is documented in the help:
If Visual mode is not active and the "v", "V" or CTRL-V is preceded with a count, the size of the previously highlighted area is used for a start. You can then move the end of the highlighted area and give an operator. The type of the old area is used (character, line or blockwise).
- Linewise Visual mode: The number of lines is multiplied with the count.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With