Visual Mode Tricks

Block O for diagonal corners. gv to re-select.

Keys: O, gv

Two tricks that make Visual mode much more useful: O in block mode swaps to the opposite diagonal corner, and gv re-selects the previous selection.

Two small tricks save lots of pain in Visual mode: O (capital O) for moving across the diagonal of a block, and gv for getting back the selection you just lost.

O โ€” diagonal corners

In char/line Visual, o swaps which end of the selection your motions move. In block Visual, o swaps along one diagonal โ€” but O (capital) swaps to the opposite corner of the rectangle. So you can extend the block from any of the four corners without restarting.

(in Block Visual) Move cursor to opposite corner of rectangle
KeyNote
O
O โ€” block-visual diagonal

gv โ€” re-select last visual

Pressed Esc by accident? Did one operation and want to do another on the same range? gv restores the last visual selection โ€” same anchor, same cursor, same mode.

Re-select previous visual range
KeyNote
g
v
gv โ€” re-select previous visual

Reference

Key Action
o Swap cursor / anchor (any visual)
O Move to opposite corner (block visual only)
gv Re-enter previous visual selection

See also: Line and Block Visual, Character Visual Mode, {key:gv} โ€” Re-Select