Swap and Duplicate Lines

ddp swaps two lines. yyp duplicates one.

Keys: dd, p, yy

Two of the oldest Vim recipes: ddp moves the current line down past the next one (a swap); yyp duplicates the current line. Both compose primitives you already know.

Two recipes you'll see in every "Vim tricks" list. They aren't features โ€” they're compositions of primitives that happen to do something useful.

Recipe Effect
ddp Swap current line with the one below
ddkP Swap current line with the one above
yyp Duplicate current line below
xp Swap two characters

Watch

See also: Delete, Yank and Put