dd (delete line)
What is dd (delete line)?
dd (delete line): Vim: delete the current line. Press twice — d then d. In Vim, dd deletes the current line. Press d twice in normal mode. The deleted line goes into a register, so you can paste it elsewhere with p, which makes dd and p the Vim way to move a line.
Frequently asked questions about dd (delete line)
How is dd (delete line) used in practice?
It follows Vim's pattern of operators and motions. d means delete, and doubling an operator applies it to the whole line. A number in front repeats it: 5dd deletes five lines. u undoes the last change if you went too far.
What should you keep in mind with dd (delete line)?
It is worth knowing even if Vim is not your main editor. You will meet it on servers, in Git commit messages and in tools with Vim key bindings. A handful of commands like dd, u, i and :wq already make those moments much less stressful.
At a glance
| Category | Keyboard shortcuts |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |