Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

Usually in the debugging of the microcontroller program, prefer to use Notepad++ to view the code, although the more popular is VSCode software to view the code, but I still prefer to use Notepad++ this notepad style interface.

When using this software to view the code, sometimes the code is not aligned, it looks inconvenient, I thought it would be good if this software can format the code, I found a software online that supports the installation of the formatting code plug-in.

Download the NppAStyle plug-in for formatting code, which can be downloaded directly from the official website

sourceforge.net/projects/nppastyle/

Go to the site and click the download button.

Wait a few seconds and the download dialog box will pop up. Select the location to save the file and click the Save button.

Decompress the downloaded installation package

The next step is to open the Notepad++ installation directory.

Go to the plugins directory, which contains the Notepad++ plugin.

Create a new file in this directory to hold the formatting plug-in.

Create a new NppAStyle folder and copy the nppastyle. DLL file from the Unicode folder in the plugin file you just downloaded into the new NppAStyle folder.

At this point, restart the Notepad++ software.

To Format the Code directly, select the plugin -NppAStyle- Format Code from the toolbar.

Select the Option Option below to set the formatting style of the code

Click OK when you’re done.

Each time you need to format the code, you can choose from the toolbar or directly use the shortcut key Alt + F to format the code.

This is what the code looks like after it’s been formatted, so it’s easier to read.