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 · par: 4 keystrokes (vimgolf rules — every keypress counts).

Why it works

V selects whole lines no matter where the cursor sits. Great when the unit of work is “these lines” — you see exactly what's about to go.

Variations

KeysWhat it does
Vjjselect three lines
V}select to the end of the paragraph
VGselect to the end of the file

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.

Practice free — no signup →

Keep going