How to remove empty lines in html code in atom?


How to remove empty lines in html code in atom?

Deleting all empty lines
Is there a way to remove empty lines using find and replace?

If you do a Find in Buffer and set regex to on, this orta do it:

^(?:[\t ]*(?:\r?\n|\r))+

Leave the replace field blank and click ‘Replace All’.


If you normally strip-trailing-whitespace-on-save, then a simpler regex might be to find \n+ and replace with \n. You could also run the strip trailing whitespace command manually, and then run the regex find/replace. It’s two steps instead of one, but also much easier to remember and write.


try ‘delete-whitelines’ package, click here


Try this one …

  1. position on empty line
  2. alt-f3
  3. backspace
  4. enter


awesome, thank you. it’s pretty hard to remember :wink: is there a way to make a shortcut?


Our world is complicated enough coders! Try to take it easy then.

Toggle on Regex, search for ^\s\n and click Replace All.
(Not only for HTML, but everything coded)

That’s it :smiley:


'delete-whitelines’ package works fine,
But whether there are some utility packages/addons that contains common used utility commands like remove empty lines etc?


You can put that sort of thing in your init script.


these actions can cause the program to hang