Learn Vim / How to Select All in Vim

How to Select All in Vim

The answerPress ggVG — top of file, line-wise visual mode, extend to the last line.

In vim you rarely need select-all: operators take motions directly (ggyG copies the whole file with no selection step). But when you want to see it, ggVG is the move.

All the ways

KeysWhat it does
ggVGselect the whole file
ggyGcopy the whole file — no selection needed
:%ycopy all lines via ex command
ggVG"+yselect all + copy to system clipboard

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

Practice free — no signup →

Keep going