You can kill the background for speed, if you wish.[x]

Monday, March 2, 2009

Syntax Highlighting for SPIM in Notepad++

For one of my classes we're working with SPIM, and I wanted my code to print out all nice and pretty, which means syntax highlighting. After a little digging through the docs (and finding the counterintuitively placed "View->User Define Dialog" option), I managed to create a user-defined language for SPIM. You can just copy the text below into your userDefineLang.xml to add it, or if you haven't done any user defined languages yet, just download this userDefineLang.xml from my settings and save it to your Notepad++ directory. This file also includes definitions for Smarty as well, just because I didn't see any reason to strip it out. So if you program in PHP and use Smarty, you get a bonus! If you do PHP and not Smarty, I'd recommend checking it out - it makes my life a lot easier.

P.S. I still can't spell recommend right on the first try for the life of me. Stupid word.

P.P.S. When I realized all the angly brackets would mess with the HTML, I hit upon the idea of using a quick
print htmlentities(file_get_contents("/path/to/file.xml"));
in a
php -a
console to HTMLize it, which worked beautifully. Nice.

P.P.P.S. To stop Blogger from inserting <br/> tags all over the place and messing everything up, I had to set "Convert Line Breaks" to "No" in Settings->Formatting. Just FYI.

1 comment:

Anonymous said...

Thank you for sharing Syntax Highlighting for SPIM in Notepad++

I was looking for it!