Learn Vim / How to Delete a Paragraph in Vim

How to Delete a Paragraph in Vim

The answerFrom anywhere inside it, press dap — delete a paragraph, including the blank line after it.

Try it on a real buffer

Delete the middle paragraph and the gap it leaves behind: move into it with 3j, select “a paragraph” with vap, then d.

The first paragraph earns its place.
It stays exactly where it is.

This middle paragraph is pure filler.
It rambles without adding anything.
Nobody will miss it when it's gone.

The final paragraph sticks the landing.

Canonical solution: 3j vap d · target: 5 keystrokes — the fewest that solve it (every keypress counts).

Why it works

Paragraphs are blank-line-delimited. ip is the paragraph text only; ap includes the trailing blank line, so deleting it doesn't leave a double gap. Target counts 3j dap (5); vap d is one key longer but shows the selection.

Variations

KeysWhat it does
dapdelete the paragraph + trailing blank line
dipdelete the paragraph text only
vapselect it first, then decide
{ / }jump to previous / next paragraph boundary
▶ live vim buffertarget 5 keystrokes
Delete the middle paragraph and the gap it leaves behind: move into it with 3j, select “a paragraph” with vap, then d.

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

Sign in free to practice →

Keep going