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”:


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:


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.



Don't forget :d5 to delete the current line and 5 subsequent ones.

Also, just a thought but I think you should compile all the basic vim commands into one blog post and only post the advance ones individually. Same goes for mac tips.

Thanks for your comments. In this case I was just writing some short tips that would be published while I was out of town, but I do need to combine these.