I would like to replace every section of newlines - for example, a single newline at the end of a line, or 5 newlines at the end of a line until the next line of text - with a single newline.
I tried to do this with:
:%s/$\n*/\r/
, but this did not result in a bunch of lines with the exact same amount of newlines between them.
Maybe the problem is that some of the seemingly "blank" lines actually have a space on them, so the expression is treating 3 blank lines as 3 separate matches and re-inserting 3 carriage returns in total.
In general, what is the most standard regex for "any amount of blank space from the end of a line with text in it until the next line with text in it", or what would be a good way to fix this?