vimtricks.wiki Concise Vim tricks, one at a time.

How do I switch between character, line, and block visual selection without starting over?

Answer

v / V / <C-v> (while in visual mode)

Explanation

While you are already in visual mode, pressing v, V, or <C-v> switches the selection type in place — the selection endpoint stays where it is and only the mode changes. There is no need to press <Esc> and restart the selection from scratch.

How it works

Key Effect
v Switch to / stay in charwise visual mode
V Switch to linewise visual mode
<C-v> Switch to blockwise visual mode

Pressing the key for the current mode exits visual mode entirely (same as <Esc>).

Example

You visually select a few words with v and then realize you need whole lines. Instead of pressing <Esc> and reselecting:

  1. While in charwise visual mode (v), press V
  2. The selection expands to full lines instantly — same start and end positions, just linewise

Or you have a linewise visual selection and want to turn it into a block:

  1. Press <C-v> while in V mode
  2. The selection becomes a rectangle — useful before pressing I to insert on every line

Tips

  • The cursor position is preserved when switching modes, so the selection boundaries stay the same.
  • Use o to toggle the active end of the selection before switching mode to anchor the right corner.
  • After switching to <C-v>, use $ to extend the block to the end of the longest line.

Next

How do I exclude compiled files and dependency folders from Vim's file name completion?