Reindenting C Source Code Files With Notepad++

By , February 19, 2012 11:24 am
MikroC indented code

MikroC indented code

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++.
http://notepad-plus-plus.org

2. Download the Unicode version of the Notepad++ TextFX plugin v0.26
TextFX.v0.26.unicode.bin.zip

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)...

Import the new plugin into Notepad++.

Import the new plugin into Notepad++.

In the open dialogue select the NppTextFX.dll file. Notepad++ will then install the TextFX plugin into the Notepad++ plugins folder.

Import the TextFX notepad++ plugin.

Import the TextFX notepad++ plugin.

4. Let's open Notepad++ and edit the tab settings. Go to the Settings menu and Select Preferences...

Edit the Notepad++ Preferences.

Edit the Notepad++ 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.

Edit the Notepad++ Tab settings.

Edit the Notepad++ Tab settings.

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.

Print Friendly

Pages: 1 2 3

4 Responses to “Reindenting C Source Code Files With Notepad++”

  1. Laura says:

    For a Canon PowerShot SD780 IS, I read your post in this group about CHDK and I was so excited, only to find out that under my menu options, I don't have a firmware update section. I have searched for it, I can't find it. Any suggestions?

  2. Andrew says:

    Hi Laura.

    You can still load CHDK on your SD780IS without using the firmware update menu item technique. What you need to do is make your SD memory card bootable with CHDK. Then when you start your camera up CHDK will load automatically from your SD memory card.

    Here is a blog post I wrote about loading CHDK on a SD780IS camera.

    If you are on Windows you need to use the Cardtricks utitlity to install CHDK and make your SD card bootable:
    http://chdk.wikia.com/wiki/CHDK/Installing_with_Cardtricks

    If you are on Mac OS X you need to use the SDMInst CHDK installer:
    http://www.zenoshrdlu.com/clickpansdm/sdminst.html

    Regards,
    Andrew

  3. Laura says:

    Thank You so Much!
    The information you gave me was very helpful and after about 2 to 3 hour of mind boggling finger pushing, I think I have accomplished the task at hand. I was really excited about the Raw capabilities of this software, I’m new to photography but I understand that Raw offers a much better quality photograph. I would appreciate any information you could offer me about how to utilize the Raw capabilities of this software or point me in a direction where I may be able to obtain additional information.
    Again I Truly appreciate the immediate and valuable information you’ve given me!
    Laura

  4. Andrew says:

    Hi Laura.

    I'm happy to hear that you were able to install CHDK on your camera.

    You might enjoy this blog post I wrote about using the RAW DNG features in CHDK.

    Here is a post on bracketing images with CHDK.

    Here is a post on Enabling Super-Fine Quality JPEG using CHDK.

    Here is a post on using an intervalometer script to create time-lapses with CHDK.

    Regards,
    Andrew