Exchange current and previous selection
gv
Example
Visual 0 / 1Visual line 1 / 1one two
three four
five sixCursor on line 2, column 3 · Character selectionone two
three four
five sixCursor on line 2, column 1 · Line selectionExchange current and previous selection.
Selection active · ready to adjust or apply
Before & after
one two
three four
five sixCursor on line 2, column 3 · Character selectionone two
three four
five sixCursor on line 2, column 1 · Line selectionStart in Visual mode. Prepare a previous linewise Visual area covering the first two lines with Vj then Esc, then a current characterwise area with vll. gv exchanges the current and previous areas.
Details & Vim help
Example replayed in Vim
Exchange current and previous selection. Use in Visual mode. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.