sublimetext2sublimetext3text-editor

How can I remove a line break and all spaces on the next line in the Sublime Text editor?


It happens many times when we need to remove a line end and unnecessary space between an HTML element. So this could be proven as a time-saving technique.


Solution

    1. open Search and replace (CTRL+H)
    2. enable "Regular Expression" (circled in red)
    3. enter \n\s+ in the search field, clear the replace field
    4. press "Replace all"

    enter image description here

    This will remove all newlines (\n+) followed by all whitespace (\s+) in the next line.