Copy the entire file: gg to jump to the top, then yG yanks from here to the last line. (Or try :%y — or ggVGy with visual mode.) The file must stay unchanged.
# dotfiles worth stealing set relativenumber set clipboard=unnamedplus remap caps lock to escape
Canonical solution: gg yG (or :%y) · par: 4 keystrokes (vimgolf rules — every keypress counts).
Operators combine with any motion: yG = yank to end of file, y5j = yank five lines down. The ex flavor :%y yanks every line without moving the cursor at all.
| Keys | What it does |
|---|---|
| ggyG | yank the whole file |
| :%y | same, without moving the cursor |
| ggVGy | same, via visual mode (you see the selection) |
| :%y + | yank the whole file to the 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 →