Learn Vim / Out of order — vim

Out of order — vim

The answerCanonical keystrokes: dd p.

Try it on a real buffer

These two lines are swapped. With the cursor on line 1, press dd then p — delete the line, then paste it back below.

line two (belongs second)
line one (belongs first)
line three (already fine)

Canonical solution: dd p · par: 3 keystrokes (vimgolf rules — every keypress counts).

Why it works

dd doesn't just delete — it cuts into a register. p pastes it below. ddp is the classic “swap this line with the one under it”.

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

Practice free — no signup →

Keep going