vim FAQ: How do I delete all lines in the current text file in vim?
To delete all lines in vim, use this command:
This vim “delete all lines” command can be read like this:
:character starts vim’s “last line mode.”
1means, “starting at line 1”
,$means, “until the end of the file”
After typing the
d, you need to hit the [enter] key, and when you do so, all lines in the file will be deleted.
If you needed to see how to delete all lines in a file using vim, I hope this is helpful.