Vim Visual Mode — v, V, Ctrl+v Selection Techniques

Master Vim's three Visual mode types: character-wise (v), line-wise (V), and block-wise (Ctrl+v). Learn selection, manipulation, and Visual mode-specific operations.

Visual Mode

Detailed Explanation

Three Types of Visual Mode

Visual mode lets you select text and then operate on the selection:

Key Mode Selects
v Visual (character) Characters from start to cursor
V Visual Line Entire lines
Ctrl+v Visual Block Rectangular column blocks

Common Operations on Selections

Once text is selected, these operators act on the selection:

Key Action
d Delete selection
y Yank (copy) selection
c Change selection (delete and enter Insert)
> Indent selection
< Unindent selection
u Lowercase selection
U Uppercase selection
~ Toggle case
o Move to other end of selection
gv Reselect last visual selection (from Normal mode)

Visual Block Mode (Ctrl+v)

Block mode is uniquely powerful for column operations:

  1. Press Ctrl+v to start block selection
  2. Move to expand the rectangular region
  3. Press I to insert text at the beginning of each line
  4. Type your text, then press Esc
  5. The text appears on all selected lines

This is invaluable for:

  • Adding a prefix to multiple lines (e.g., commenting out code)
  • Inserting columns of text
  • Editing aligned data

Visual Line Shortcuts

V followed by j or k quickly selects multiple lines. Common patterns:

  • Vip — Select inner paragraph
  • Vi{ — Select inside curly braces
  • V} — Select from current line to next blank line

Use Case

You need to select and manipulate blocks of text, indent multiple lines, perform column edits, or apply operations to a specific selection of code.

Try It — Vim Cheat Sheet

Open full tool