blockwise visual mode with ragged border
To extend the blockwise visual selection to the end of all covered lines, you can press $
to switch Vim into a "ragged border" selection mode. This "trick" is mentioned at :help v_b_A
:
With a blockwise selection, A{string} will append {string} to the end of
block on every line of the block. There is some differing behavior where the
block RHS is not straight, due to different line lengths:
- Block was created with $
In this case the string is appended to the end of each line.
- Block was created with {move-around}
In this case the string is appended to the end of the block on each line, and whitespace is inserted to pad to the end-of-block column.
virtual edit
Another way to solve this is via the 'virtualedit'
option:
:set virtualedit=all
This makes the space following the end of the line accessible to cursor movements, so you can extend the selection as much as you need. Yanking that text will have whitespace padding inserted to make a rectangular block, so the behavior is different to the above alternative.