How do I reselect the previous visual area and convert it to linewise selection?
Answer
gvV
Explanation
gv is well known for reselecting the previous visual area, but pairing it with V is a practical upgrade when your next action needs linewise semantics. This combination is helpful after a characterwise edit when you realize the follow-up command should operate on full lines, such as line comments, alignment, or linewise filtering.
How it works
gvrestores the last visual selection boundsVconverts the active selection to linewise Visual mode- The same region is preserved conceptually, but Vim expands it to whole lines
This lets you pivot selection type without manually reselecting a large region.
Example
Suppose you previously selected a partial range across multiple lines and made a characterwise change. Later you decide the same region should be handled line-by-line:
alpha one
beta two
gamma three
Run:
gvV
Now the last area is active again as a linewise selection, ready for operations like linewise commenting, indent shifts, or :'<,'>normal commands.
Tips
- Use
gvalone when you need exact prior character boundaries - Use
gv<C-v>if you instead need to reinterpret the previous area as blockwise - This pattern is excellent in review/refactor loops where you repeatedly revisit the same region with different operator types