Skip to main content

Delete Line in Vim (Linux)

Press dd to delete the current line.

What it does

The whole line is removed, wherever the cursor stands in it, and the lines under it move up. The deleted line goes into a register, so it can be pasted somewhere else, which makes the command the way to move a line as well. A count typed before the command deletes that many lines, starting with the current one.

The same shortcut on other platforms

PlatformShortcut
Linuxthis pagedd
macOS

More Vim shortcuts: Editing

  • Yank (Copy) Line
  • Paste After
  • Paste Before
  • Undo
  • Redo

All 30 Vim shortcuts for LinuxThe full list has a search and a printable PDF.

Questions

What is the Vim shortcut for Delete Line on Linux?

dd. Press it to delete the current line.

What is the shortcut for Delete Line in Vim on macOS?

On macOS it is dd.