Shaping Lines: J, >> and gq

J — join

J joins the line below onto the current one, collapsing the indentation into a single space. 3J joins three lines. gJ joins without adding a space.

>> and << — shift

>> indents a line by one shiftwidth, << outdents. They take counts and motions: 3>>, >ip for a paragraph, or > on a visual selection.

In visual mode, > then gv re-selects so you can shift again.

gq — reflow

gq{motion} reformats text to textwidth. gqip reflows the current paragraph — the fastest way to tidy a long comment or a Markdown block.

gw does the same but keeps the cursor where it was, which is often what you want.