How do I allow block selections past end-of-line while still permitting one-char past EOL cursor movement?
Answer
:set virtualedit=block,onemore
Explanation
virtualedit controls whether the cursor can move to positions that do not yet contain text. Combining block and onemore is a practical setup for advanced editing: blockwise operations can extend past short lines, while normal movement can still step one character past end-of-line for cleaner append workflows.
How it works
blockenables virtual positions for Visual Block mode onlyonemoreallows the cursor to move one column past the last character in normal mode- Together, they avoid the more invasive
allsetting while still enabling precise column edits
This is especially useful when aligning ragged columns, adding suffixes to uneven lines, or doing rectangular changes where some lines are shorter than others.
Example
alpha
beta-long
pi
With virtualedit=block,onemore, you can start a block selection on alpha, extend into the same visual column on pi even when the text is shorter, and insert/append consistently across all selected lines.
Tips
- Pair with
<C-v>,I, andAfor powerful multi-line column edits - If motion feels too permissive, prefer this over
virtualedit=all - Use
:set virtualedit?to confirm current effective value