How do I adjust the width of a visual block selection without restarting it?
Answer
O (visual block mode)
Explanation
In visual block mode (<C-v>), pressing O (uppercase) moves your cursor to the other end of the current line — letting you expand or contract the block's horizontal extent without losing your selection. Combined with o (lowercase), which jumps to the diagonally opposite corner, these two keys give you full control over any corner of the block.
How it works
<C-v>— enter Visual Block modeo— move cursor to the diagonally opposite corner (changes both line and column)O— move cursor to the other end of the current line (changes only column, keeps current row)
This is especially useful when you realize after starting a block selection that you need to widen or narrow it, or when you started from the wrong side of a column.
Example
You're selecting a block over three lines and want to adjust the right edge:
foo = 1;
bar = 2;
baz = 3;
Start with <C-v>jj to select three rows, cursor on f. Press O to jump the cursor to the right end of the current line (column of f to same line, other side). Now extend rightward with e or $ to include the full assignment — no need to restart.
Tips
- Use
oto toggle between all four corners of the block for precise selection tuning - Works the same way in
:help visual-block:ogoes to opposite corner,Ogoes to opposite side of same line - After adjusting, you can apply any operator:
d,c,I,A,~,>