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.
Visual mode Tricks
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 character-wise or linewise visual mode, o swaps which end of the selection your motions move. In visual-block mode, o swaps along one diagonal โ but O swaps to the opposite corner of the rectangle. So you can extend the block from any of the four corners without restarting.
| Key | Note |
|---|---|
| {key: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 |
|---|---|
| {key:g} | |
| {key:v} |
Reference
| Key | Action |
|---|---|
| o | Swap cursor / anchor (any visual) |
| O | Move to opposite corner (visual-block mode only) |
| gv | Re-enter previous visual selection |
See also: Line and Block Visual, Character Visual Mode, Re-Select โ gv