How do I delete all blank lines in a file? How do I remove all the

lines containing only space characters? To remove all blank lines, use the following command:

    :g/^$/d

To remove all lines with only whitespace (spaces or tabs) in them, use the following command:

    :g/^\s\+$/d

To remove all the lines with only whitespace, if anything, use the following command:

    :g/^\s*$/d

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind