Everybody knows that when I’m at Windows my favorite editor is Notepad++. It’s an opensource source code ( opensource source code – I liked it! ) editor which supports serveral programming languages and has a bunch of interesting features like:

  • Auto-completion
  • Snippets
  • Multi-Document
  • Multi-View
  • Regular Expression Search/Replace
  • Plugins interface

Although it also support customized Syntax Highlighting there aren’t too many options available… But this ends today…

Yeah, that’s true, after a long time using a modified and extended version of the tomsolo’s port of Ruby Blue style I’ve become tired of it’s lack of support for different languages ( the tomsolo version supports only CSS, HTML, Javascript, PHP, SQL, XML ) and some base tasks like search results. This motivated me to start a new project called “tmTheme2nppStyler” which should convert files from the world biggest editor theme library ( Textmate tmThemes ) into Notepad++ stylers.xml.

Analyzing the problem

Textmate tmThemes files are stored in a XML dialect called PLIST, uses a first impression odd Scope Selectors pattern which enables users to add their own loosely standardized naming convention to their favorite programming language. In other words: Not all tmTheme files contains every style Notepad++ requires and, if it has, there is no safe way to discover which name the author used to structure his grammar. This way, the only thing I could do is to focus on the Macromates Language Grammars manual and pray for a good structured tmTheme source.

On the other hand Notepad++ also uses XML but with a customized format and have fixed expressions for each supported language.

Ok, it seems that the worst part of the job is to parse the PLIST, get a bunch of themes and detect some selectors patterns, choose a style and use the naming conventions to find the right theme entry and apply it, right? Right! That’s exactly what the program do. Easy to say, hard to implement ;D and this is the reason none did it before IMHO.

Building the program

Ahhh… I’ll skip this XD too boring…

Final result

The Textmate tmTheme to Notepad++ styler is available at http://framework.lojcomm.com.br/tmTheme2nppStyler/ and provides a fast and easy way to convert any tmTheme ( you can find a lot of them at http://wiki.macromates.com/Themes/UserSubmittedThemes ) into a stylers.xml. Note that sometimes the conversion is not perfect due to the reasons I mentioned before. But it really does the hard part of the job.

Some candies

For test reasons I’ve selected some themes I liked, converted them and fixed the eight-digit hexadecimal colors. You can download them from their goodies permalink .

Final notes

Despite the problems with Textmate eight-digit hexadecimal colors which generate strange styles in Notepad++, I think the program output is pretty good!