How to use Notepad++ for Adruino Dev?

The "N++ Arduino Plugin" is available at SourceForge HERE

I'm wondering if any of you guys use it and is it the only NotePad++ alternative.

Thanks for any help.

PS
FYI, there is a video HERE that shows how to get Notepad++ and set it up to work with Arduino.

I haven't attempted any such complete integration of NotePad++ with the Arduino framework. My approach was to use the IDE's File > Preferences > Use external editor feature, then use NotePad++ solely as an editor, still using the IDE for compiling, uploading, installing libraries, and installing boards. What I found I was missing was to be able to format my code to the standard Auto Format style. I'll share the solution I found for that (some years ago, so possible there are small updates needed):

Everyone has their preference of formatting style but my opinion is that what's important is to set a standard and use it consistently. The Arduino IDE has set a formatting standard with the configuration of Tools > Auto Format . I use this on all my sketches but I also want to use this formatting standard in my library and bootloader source files which I frequently edit with Notepad++ so I decided to add Arduino IDE style auto formatting:

  1. Download astyle Artistic Style - Browse Files at SourceForge.net
  2. Install NppExec plugin: Plugins > Plugin Manager > Show Plugin Manager > NppExec > Install > validation failed, proceed anyway > Yes > Restart > Yes
  3. Plugins > NppExec > Execute...
  4. Add the following commands(with paths modified to your system):
    npp_save
    "C:\Program Files (x86)\AStyle\bin\AStyle" --options="C:\Program Files (x86)\arduino-1.6.9\lib\formatter.conf" "$(FULL_CURRENT_PATH)"
    npp_open $(FULL_CURRENT_PATH)
    
    AStyle will back up the input file as {filename}.orig in the same folder. If you don't want to save the AStyle backup file, use the following commands instead:
    npp_save
    "C:\Program Files (x86)\AStyle\bin\AStyle" --options="C:\Program Files (x86)\arduino-1.6.9\lib\formatter.conf" "$(FULL_CURRENT_PATH)"
    npp_open $(FULL_CURRENT_PATH)
    cmd /c del "$(FULL_CURRENT_PATH).orig"
    
  5. Save > Arduino Auto Format > Save > OK
  6. Check the console output to see if the commands were run successfully. You can edit the commands by Plugins > NppExec > Execute...
  7. Plugins > NppExec > Advanced Options... > Associated script: Arduino Auto Format > Add/Modify > Place to the Macros submenu(check) > OK > OK
  8. Restart Notepad++
  9. To set the same shortcut key for Auto Format: Macros > Modify Shortcut/Delete Macro... > Plugin commands > Arduino Auto Format > Shortcut > Ctrl + T > OK > Close

After doing an Arduino Auto Format you can't use Edit > Undo to revert the change but if you're using the first Auto Format commands, which saves the backup file, you can add the option to undo the auto format:

  1. Plugins > NppExec > Execute... > select "" from the dropdown menu
  2. Add the following commands:
    cmd /c move/Y "$(FULL_CURRENT_PATH).orig" "$(FULL_CURRENT_PATH)"
    npp_open $(FULL_CURRENT_PATH)
    
  3. Save > Undo Arduino Auto Format > Save > OK
  4. Check the console output to see if the commands were run successfully. You can edit the commands by Plugins > NppExec > Execute...
  5. Plugins > NppExec > Advanced Options... > Associated script: Undo Arduino Auto Format > Add/Modify > Place to the Macros submenu(check) > OK > OK
  6. Restart Notepad++

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.