Archive for February 10th, 2017

How to delete all lines in vi or vim editor

To delete all the lines of the file in vi or vim, makes sure you have your file opened in the command mode (esq) and not the input mode (i). It takes two steps:

  1. Go to the top of the file by pressing “gg”.
  2. Press “dG” (notice capital “G”, “d” followed by “Shift+g”).

That’s it. You can now save the empty file with “ZZ”.