Step 6 of 7

5. Visual Mode

Reselecting the last visual region

You might start a visual selection over some text, and accidentally hit the wrong key, dropping you back into normal mode with no text selected. Mistakes happen!

But fret not: Vim remembers your last visual selection, so if you back out of visual mode for any reason, you can easily get back to where you were.

The mapping for this is gv in normal mode.

Work through the checklist below to recover a lost selection for yourself.

  1. Select a region of text Put the cursor anywhere in the text, then press v.
  2. Back out to normal mode Extend the selection over a few words — it will disappear when you hit Escape. (Deleted the text by accident? u undoes it.)
  3. Reselect the region with gv The same selection will light back up — press g then v.
Select a region of text Put the cursor anywhere in the text, then press v.

Next: Back out to normal mode

Loading editor…