Syntax highlighting in Notepad++ external editor

I wasn’t sure where to post this.

I found this nice post about how to use Processing with Notepad++. So I’ve been playing a bit with that lately (Windows 7, 64-bit), and it seems to work great (But I’ll probably still use the default editor for some things like looking at the included examples, installing libraries and start making new projects).

I didn’t find any Processing language syntax highlighter for it, so I made an attempt at making one. I just thought I’d offer it here in case others find it interesting.

Just download, extract file, go to menu Language - Define your language and import it. Should be it.

Except you might also want to adjust some things that aren’t part of the UDL (User Defined Language). From Settings menu, select Style Configurator. In particular look at Global Styles - Default Style and background / foreground colors. Maybe also Brace highlight.

Then Settings menu again - Preferences - Language - Tab Settings. You might want to click on the Tab size value and change it. I use 2 spaces for Tab atm (hit Enter key afterwards, as there’s no OK button there). Or not. Just a suggestion.

It’s not perfect ofc. I found NPP’s UDL a bit lacking, but it is what it is. I couldn’t get it to distinguish class methods (functions) from class variables (fields/members?) for example. As NPP “only” have 8 keyword groups, I had to collate a few categories too (I only used 7 even, so far).

Code folding seems like a mess too, not always syncing up with the code (and I’m not sure where it’s color is from either btw).

Colors are pretty subjective ofc, but it’s not hard to change.

Hope it is of some use.

5 Likes

I’ve continued my Notepad++ Processing Procrastination a bit, by looking into npp’s function list view. Plus the Custom Toolbar plugin, so now I also have a button to click to run Processing sketches from npp.

Unfortunately there isn’t a one-click install, but settings are spread over different files. I’m just putting this out here in case others are interested.

(PS! Back up any files you delete / change, just in case. So don’t blame me if you need to reinstall npp)
.

Now, I “don’t know what I’m doing”, but afaik Processing is basically Java so I simply copied Java’s class and function parser (I used the XML file provided with Notepad++ ver. 7.6.6 64-bit). Also tweaked it to show functions outside of classes.

Installing the function list:

The file functionList.xml (linked) needs to be placed in Notepad++'s install folder. There is also another one in the Roaming folder (like C:\Users\USERNAMEAppData\Roaming\Notepad++). This file needs to be deleted! (It will be automatically backed up from the install folder when NPP starts. But afterwards this file will be the “master file” that will be used. So any changes you make to the one in the install folder, won’t be effective until the file in the Roaming folder is deleted again).

functionlist

ProcessingP
Custom Toolbar button:

It’s just a simple capture / resize of the “P” from Processing. Sure it’s just Ctrl-R (or whatever you define in the Shortcut Mapper), but I find it handy sometimes to have a button to click (After defining the macro from the post linked in the first post ofc).

You’ll need the plugin “Customize Toolbar” for this (Menu Plugins - Plugins Admin). The plugin’s help menu explains most. Except to use the config folder in C:\Users\USERNAME\AppData\Roaming\Notepad++\plugins\config (Maybe unless you did the portable install of npp, in which case I think it’s just in the install folder\plugins\config). Download link.

But in short add a line to the file “CustomizeToolbar.btn”:
Macro,Processing,,,ProcessingP.bmp

That is if it’s visible in the Macro menu, as “Processing”. If you edit it in npp (recommended!), it needs to have the encoding set to UCS-2 LE BOM (Little Endian, with optional BOM - Byte Order Mark).

You also need to activate “Custom Buttons” first (Plugins - Customize Toolbar - Custom Buttons).

.

Oh, and I also tweaked the syntax highlight colors ever so sligthly, to perhaps be a little bit easier on the eyes (rather download the one at edit #2 below instead).

20

EDIT: Forgot Custom Buttons needs to be activated (see above).

EDIT #2. A bit annoying, I forgot a dot as an “operator style”, making method names after a dot not colored. New download (Swithced a handfull of “structure” keywords colors to stand out a bit more too).

5 Likes

Did you try to run Processing on Notepad++.
I followed this tutorial, but can’t get it working.

Yes, just follow the first link in the first post here. Quoting the important part of “cameyo”'s post below:

Using Notepad++ with processing 3.0:

Install NppExec plugin
Menu: Plugin -> NppExec -> Console Output... (set both console to UTF8)
Menu: Plugin -> NppExec -> Execute...
insert text: processing-java --sketch="$(CURRENT_DIRECTORY)" --force --run.
Press "Save" button and name it "processingExec".
Close and restart notepad++
Menu: Plugin -> NppExec -> Advanced Options...
Press "Associated Script" and select "processingExec"
Set "Item Name" to "processing".
Press "Add/Modify" button.
Activate the checkbox "Place to the Macros submenu".
Close and restart notepad++
Menu: Settings -> Shortcut Mapper...
Press "Plugin" button and search the processing item.
Assign a shortcut.

Now you can run processing from Macro menu or with the shortcut

I’m a bit out of touch with Processing after some time off (yet again), but I recently did this procedure with Notepad++ and Processing in Windows 10, which still works great.

1 Like

As Processing is basically Java, one can use this useful resource to get some help.

1 Like

So I’ve been messing a bit more with Notepad++ lately (and less with Processing lol, but still some, just preparing… err…or, procrastinating…).

I turned down the contrast a bit.
(And btw yes the code folding is a mess for some reason).

Example dark theme

A new download below is a “style” / theme, which I omitted earlier. Because not all colors are included in the UDL (User Defined Language) syntax color settings, like default background, selection colors etc. Ofc, adjust to your own liking, it’s just offered for convenience (hopefully). Btw it’s just a modified “Black Board” theme in Style Configurator (I haven’t changed all the settings either, some I don’t know what is for).

functionList.xml remains the same as in post 2 above.

New downloads:

The latter theme file need to be placed in the folder:

C:\Users\USERNAME\AppData\Roaming\Notepad++\themes

(If your Windows installation is on the C drive, ofc. Change it if required).
Also, not sure what the folder is for a portable install of Notepad++ (guessing it’s in the install folder?).

To use the theme, select it in Notepad++ menu: Settings - Style Configurator… - theme drop-down list.
For the first file (syntax coloring), instructions are in the first post.

3 Likes