How do I move to the opposite corner of a visual block selection?
Answer
O in visual block mode
Explanation
In visual block mode (<C-v>), pressing O (uppercase) moves the cursor to the diagonally opposite corner of the rectangular selection. This lets you adjust both the horizontal and vertical extent of the block from any corner without restarting the selection.
How it works
o— moves the cursor to the other end of the selection vertically (same as in regular visual mode)O— moves the cursor to the opposite corner horizontally within visual block mode
The key difference: o toggles between top and bottom of the selection, while O toggles between left and right on the same row. Together they let you reach any of the four corners.
Example
Starting with a block selection from (1,1) to (3,5):
[xxxxx]
[xxxxx]
[xxxxx]
With cursor at bottom-right (3,5):
- Press
O→ cursor moves to bottom-left (3,1) - Press
o→ cursor moves to top-left (1,1) - Press
O→ cursor moves to top-right (1,5)
Now you can extend the selection in any direction.
Tips
Oonly works in visual block mode (<C-v>), not in regular visual or visual line mode- Use this when you started a block selection and realize you need to extend it in the opposite horizontal direction
- Combine with motions after switching corners to reshape the block precisely