Notepad++: Remove Duplicate Lines and Blank Lines and Enable Syntax Highlighting

In this post, you’ll see:

I use Windows 11. Let’s start.

Remove Duplicate Lines in Notepad++

Here are the steps:

Open Notepad++ file.

Hit Edit at the top. Hover your mouse over Line Operations above Comment/Uncomment.

You now have two options:

  • Remove Duplicate Lines – will eliminate duplicate lines from the document.
  • Remove Consecutive Duplicate Lines – this will remove duplicate lines that are consecutive.

Click on the one you prefer.

That’s all.

Notes:

To duplicate the line, follow these steps:

Go to the line you want to copy. Press Ctrl + D. That’s all.

Alternate Method

Go to the line you want to duplicate.

Hit Edit at the top. Hover your mouse over Line Operations, which you can find above Comment/Uncomment.

Click on the Duplicate Current Line option, and that’s it.

Remove Blank Lines from Notepad++

You can do this task using any of the below methods.

Method #1

Open the Notepad++ file and hit Edit at the top.

Hover your mouse over Line Operations, located just above Comment/Uncomment.

Now you can see these two options:

  • Remove Empty Lines – this will remove blank lines.
  • Remove Empty Lines (Containing Blank characters) – which will delete blank lines that include blank characters such as “Space.”

Click on the one you prefer. That’s all.

Method #2

This method removes spaces from the beginning of the lines and blank lines, including blank characters. To do this, use Replace.

Here’s how:

Press the keyboard shortcut Ctrl + H to open the “Replace” popup.

Select “Regular expression” in the “Search Mode” section.

In the field beside “Find what,” type this: ^\s

Hit the Replace All button.

That’s all.

Read: How to Create a Text File in Windows 11

Enable Syntax Highlighting in Notepad++

Notepad++ has syntax highlighting disabled by default. You can enable this feature, and here’s how:

Open Notepad++ and hit Language at the top.

Hover your mouse over the first letter of the programming language you are using.

For example, if you’re using Java, hover over J.

Now you can see the programming language and click it.

That’s all. Syntax highlighting is on.

Click Language at the top and click None (Normal Text) to disable syntax highlighting.

Also, note: 

If you save a file with a programming language extension in Notepad++, Notepad++ automatically enables syntax highlighting for that file.

For example, if you work with HTML code and save it as a .html file, Notepad++ will apply syntax highlighting to this file.

Also, note that if you open a programming language file in Notepad++, Notepad++ automatically enables syntax highlighting for that file.

That’s it.

I hope this guide, “Notepad++: Remove Duplicate Lines and Blank Lines and Enable Syntax Highlighting,” is helpful to you.

Thanks for reading.

See: How to Replace Notepad with Notepad++