LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What is Visual mode in VIM and how do you use it?

Visual mode highlights text first, then you act on it: v selects characters, V whole lines, Ctrl+v a rectangular block.

Visual mode is the "select, then do" workflow familiar from GUI editors — useful when a precise motion isn't obvious. You expand the selection by moving, then hit an operator (y, d, >). The standout is block mode (Ctrl+v): select a column down many lines, press I, type # , then Esc, and the text appears on every selected line at once — the classic trick for commenting out a block.

Key Selection type
v Character-by-character
V (Shift+v) Line-by-line
Ctrl+v Block/column selection

Workflow:

  1. Enter Visual mode (v, V, or Ctrl+v)
  2. Move cursor to expand selection
  3. Perform action on selection:
    • y = yank (copy)
    • d = delete
    • > = indent
    • < = unindent

Block selection example (commenting multiple lines):

  1. Ctrl+v to enter block mode
  2. Select column
  3. I to insert
  4. Type #
  5. Esc - applies to all lines!

Tip: Visual mode makes it easy to see exactly what you're affecting before taking action.

From Quiz: LIOS / Reading and Editing Files from the Command Line | Updated: Jul 14, 2026