Skip to main content

Delete Line in Vim (macOS)

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
macOSthis pagedd
Linux

More Vim shortcuts: Editing

  • Yank Line
  • Paste After
  • Paste Before
  • Delete Character
  • Replace Character

All 38 Vim shortcuts for macOSThe full list has a search and a printable PDF.

Questions

What is the Vim shortcut for Delete Line on macOS?

dd. Press it to delete the current line.

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

On Linux it is dd.