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:
- Enter Visual mode (
v,V, orCtrl+v) - Move cursor to expand selection
- Perform action on selection:
y= yank (copy)d= delete>= indent<= unindent
Block selection example (commenting multiple lines):
Ctrl+vto enter block mode- Select column
Ito insert- Type
# Esc- applies to all lines!
Tip: Visual mode makes it easy to see exactly what you're affecting before taking action.