The vim “delete line” command

vim delete FAQ: How do I delete a line in vim? (Also, how do I delete multiple lines in vim?)

To delete the current line in your vi/vim editor, use this command while you’re in “command mode”:

dd

You can use this same command to delete multiple lines in vim. Just precede the command by the number of lines you want to delete. For instance, to delete five lines in vim, use this command:

5dd

If you’re not familiar with vim, it’s important to make sure you’re in “vim command mode” when you issue these commands. I discuss this in my “vim modes tutorial.

You can find more vim “delete line” examples in my “Vim editor deleting text video” on YouTube.