// (or # ), press Esc — the comment appears on every selected line.Comment out all four lines at once: Ctrl-v for block visual, 3j to reach the bottom, I to insert at the block's left edge, type “// ” (slash slash space), then Esc — and watch it appear on every line.
config = load()
validate(config)
apply(config)
print("done")
Canonical solution: Ctrl-v 3j I // Esc · par: 7 keystrokes (vimgolf rules — every keypress counts).
Ctrl-v selects a rectangle. I inserts before it, A appends after it; on Esc the edit is replayed on every line the block touched. The closest thing vim has to multiple cursors.
| Keys | What it does |
|---|---|
| Ctrl-v 3j I // Esc | prepend // to four lines |
| Ctrl-v 3j I # Esc | same for Python/shell |
| :2,5s/^/# / | comment lines 2–5 with a substitute |
| Ctrl-v + x | uncomment: block-select the markers, delete |
Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “The column of //” mission takes about a minute.
Practice free — no signup →