editing

dd

Deletes the current line (and stores it in the unnamed register, so you can paste it back with p). The bread-and-butter 'get rid of this line' command.

dd  (normal mode)

Variations

Keystroke Effect
3dd Delete 3 lines starting from the current
d$ or D Delete from cursor to end of line
d0 Delete from cursor to start of line
dw Delete to start of next word
"_dd Delete WITHOUT overwriting the yank register (black-hole register)

Examples

dd

Delete the current line

5dd

Delete 5 lines starting here

ddp

Classic swap-lines trick: delete this line then paste it below (swaps with next line)

Gotcha

dd is a CUT, not a delete — the line goes onto the yank register and will overwrite whatever you last yanked. Use "_dd if you want to preserve your yank.

Related

← All Vim commands · Vim cheat sheet