vim command

Vim dd Command: Delete Lines Efficiently

Master dd and count prefixes for fast line deletion workflows in Vim.

Published: 2026-03-09Updated: 2026-03-09
`dd` is the core command for removing lines and refactoring quickly in Vim.

Core usage

Use dd to delete the current line. Prefix with a count like 3dd to delete multiple lines in a single command.

Workflow tips

Pair dd with p/P paste and undo for fast line movement and experimentation during refactors.

Common Mistakes

  • Running dd repeatedly instead of using a count.
  • Deleting from the wrong anchor line.

FAQ

How do I delete 5 lines quickly?

Use 5dd while on the first line you want to remove.

Can I recover lines after dd?

Yes. Use p to paste from the default register or u to undo.

Practice This Now