vimtricks.wiki Concise Vim tricks, one at a time.

How do I delete an entire paragraph?

Answer

dip

Explanation

The dip command deletes the inner paragraph — all contiguous non-blank lines surrounding the cursor. This is useful for removing blocks of code or text.

How it works

  • d is the delete operator
  • ip is the "inner paragraph" text object
  • A paragraph is bounded by blank lines
  • Does not delete the surrounding blank lines

Example

First paragraph.

Second paragraph
with multiple lines
in it.

Third paragraph.

With the cursor in the second paragraph, dip removes the three lines of that paragraph.

Tips

  • dap deletes around the paragraph (including trailing blank line)
  • vip selects the paragraph in visual mode
  • yip yanks the paragraph
  • cip changes the paragraph
  • In code, paragraphs are blocks separated by blank lines

Next

How do you yank a single word into a named register?