On Windows, Notepad++ is probably the second most popular text editor available, just behind Microsoft Notepad.
At the point of writing this article, Notepad++ supports over 50 programming languages. It offers syntax highlighting, code folding, side-by-side document viewing, and a whole bunch of other useful features. Notepad++ features is also extendable using plugins.
I don't normally use it since I mainly interact with Linux, but once I have to get my hands on a Windows machine, Notepad++ is my text editor of choice.
In this article, I will show you how to remove blank lines, with and without whitespace characters, tabs in Notepad++.
Remove blank lines (no whitespaces)
If you want to remove the blank lines in a document, except the ones that contain whitespace characters (spaces, separators), follow the instructions below.
First you need to open the file with Notepad++. Once the document is loaded, select Edit > Line Operations > Remove Empty Lines. Voilà, every single blank lines has been deleted.
Remove blank lines (whitespaces included)
Sometimes, your document contains blank lines that does have a whitespace characters in it.
To be able to remove these lines from the document as well, select Edit > Line Operations > Remove Empty Lines (Containing Blank Characters)
Remove blank lines in selected text
Notepad++ default features above search and remove blank lines in the whole document.
But what if you want to remove empty lines in a small part of the file? Turns out, you need a plugin called TextFX to do that. TextFX is only available for 32-bit version of Notepad++ only.
To install TextFX, you need to open Notepad++ and select Plugins > Plugins Admin. Type "textfx" in the search box and press Enter.
Once you see TextFX Characters plugin, you need to check the box in front of it and click Install. Notepad++ will restart itself to download and complete the installation.
You would see a new TextFX section in the menu bar. Now if you want to eliminate empty lines in any part of the document, you need to select it, then select TextFX > TextFX Edit > Delete Blank Lines. Voilà, every single blank lines has been deleted.
Alternatively, if you're using 64-bit version of Notepad++, in which TextFX is not available, you can create a new file and cut the part you want to process it separately using Notepad++'s built-in features.
- TextFX have been removed from Notepad++ 64-bit, why?
As to why Notepad++ removed TextFX from 64-bit builds: the project has been dead for 9 years, and currently there is no one maintain it. Original source code for version 0.25 (dated 2008) can be fround from https://sourceforge.net/projects/npp-plugins/files/TextFX/. That code can be made to build on modern Visual Studio and it supports Unicode, but 64-bit build is impossible.
- What plugin can replace TextFX?
Currently, some plugins are taking over some areas where TextFX is being used:
Code alignment, NppConverter, XBrackets Lite, Tidy2
- How to remove blank lines in Notepad++ without plugins?
Select Edit > Line Operations > Remove Empty Lines or Edit > Line Operations > Remove Empty Lines (Containing Blank Characters)