Learn Vim / How to Select Whole Lines in Vim

How to Select Whole Lines in Vim

The answerPress V (capital) for line-wise visual mode, extend with j/k, then d, y, or >.

Try it on a real buffer

Delete the three CUT lines: j onto the first one, V for line-wise visual, jj to stretch the selection, then d.

KEEP the opening line
CUT this whole stanza
CUT this line as well
CUT this final offender
KEEP the closing line

Canonical solution: j V jj d · target: 4 keystrokes — the fewest that solve it (every keypress counts).

Why it works

V selects whole lines no matter where the cursor sits. Target counts j 3dd (4 keys); your V jj d route teaches line-wise selection even if it's one key over.

Variations

KeysWhat it does
Vjjselect three lines
V}select to the end of the paragraph
VGselect to the end of the file
▶ live vim buffertarget 4 keystrokes
Delete the three CUT lines: j onto the first one, V for line-wise visual, jj to stretch the selection, then d.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Line-wise vision” mission takes about a minute.

Sign in free to practice →

Keep going