Syntax highlighting in Notepad++ external editor

#1

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
#2

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

2 Likes