When you are working with source code it is nice to have the code properly indented. You can automatically reformat your unindented C / C++ files in Notepad++ to have proper indentation using the TextFX and NppAutoIndent plugins.
When using the mikroC compiler it is best to have your indentation done using 2 spaces instead of the tab character. For this task it is handy to have Notepad++ automatically convert the tab characters into spaces.
Note: The TextFX plugin was one of the first plugins created for the original ANSI version of Notepad++. Since Notepad++ has switched primarily to Unicode the TextFX plugin needs some development work to support the latest features.
Let's install and set up the TextFX Plugin and NppAutoIndent
1. Download and install Notepad++.
2. Download the Unicode version of the Notepad++ TextFX plugin v0.26
3. Now let's install the TextFX Plugin. Start by unziping the ZIP archive TextFX.v0.26.unicode.bin.zip
Next open Notepad++ and from the Settings menu select Import > Import plugin(s)...
In the open dialogue select the NppTextFX.dll file. Notepad++ will then install the TextFX plugin into the Notepad++ plugins folder.
4. Let's open Notepad++ and edit the tab settings. Go to the Settings menu and Select Preferences...
In the Preferences window open the Language Menu / Tab Settings section.
Click on the text Tab size and change the tab size to 2. This means a tab character is equal to two spaces.
Then select Available Items C to edit the settings for c code files.
Enable the replace by space option. This will change the tab indentation characters into spaces.
Click the close button to Close the preferences window.
Programs like MikroC want indentation done with spaces instead of the tab character.
4 Responses to “Reindenting C Source Code Files With Notepad++”
Leave a Reply
Note: Comments will have spelling errors corrected before they are posted. If you have a specific question please provide your email address so I can send you a direct reply.