How to remove empty lines in html code in atom?


#1

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?
#2

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’.


#3

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.


#4

try ‘delete-whitelines’ package, click here


#5

Try this one …

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

#6

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


#7

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:


#8

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


#9

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


#10

these actions can cause the program to hang


#11

Ctrl+Shift+K