Visual Mode Tricks
Block O for diagonal corners. gv to re-select.
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.
| Key | Note |
|---|---|
| O |
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.
| Key | Note |
|---|---|
| g | |
| v |
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