Is there any plugin, macro or built-in function that can remove empty or redundant empty lines in Netbeans 7.2 (PHP bundle, Windows 7)? Due to different line-break formats in my upload and download process (Win <> Unix, via FileZilla and Netbeans), many PHP files doubled (even quadrupled) their line breaks.
I could remove them file by file using PSPad - but I am looking for an automatic or batch-capable solution. I can accept an external tool if available.
Edit: I know about the Source > Format
helper, but there are no settings to remove blank lines.
You can do this with a regular expression + and a replacement. Do this in an editor window or in the project (or files) directory tree:
\n\n
\n
If you want to keep a blank line you should:
\n\n\n
\n\n
If you want to replace consecutive lines that are not empty but contain whitespaces only you should:
\n[\t\r]+$\n
\n
Try this one...
Ctrl + F (find) in Netbeans as Regular Expression:
\n\s*(\n)
and Replace All by
$1
In NetBeans 7.3 (I'm not sure about the earlier version, it should be available in 7.x)
Automatic removal:
Tools > Options > Editor > On Save > Remove Trailing Whitespace:
you can choose from: "None / All Lines / Modified Lines Only"
Manual way:
Alt + Shift + F
Yes there is one and this is a very important feature indeed. It depends on your settings but by default you can press Alt + Shift + F or find it in the context menu: Source > Format.
You can setup your own style for formating here: Tools > Options > Formatting. You can set this for all languages or individualy.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With