LESS and CSS3 syntax highlighting

cssnotepadpspadsyntax highlighting

I found this post on SU, but it doesn't seem to address my needs exactly, so I'll ask a similar question. I normally use PSPad, and I'm also not too scared of Notepad++. They are both good editors, but their CSS highlighting seems to be lacking all the CSS3 goodies.

To top that, I recently started using LESS instead of plain CSS, and this is where both editors fail miserably. As soon as nested properties are encountered, PSPad gets completely lost and is unable to even show matching braces, not to mention bad syntax highlighting. Notepad++ is somewhat better, as matching braces are always shown correctly, but still, nesting makes Notepad++ lose its way around LESS.

So, do you happen to know how I can make either of these two cooperate with LESS correctly? A downloadable resource will be fine, or perhaps a plugin, if you know of one (I don't). Alternatively, if you know of any other good lightweight editor that can offer good LESS highlighting, please point me to it (and please, no Eclipse-based stuff, it's way too heavy for just a CSS highlighter).

[Edit, in case anyone finds it useful]:

Since writing the question, I have come across a great, albeit Java-based and thus slightly sluggish, IDE. It's called PhpStorm, created by JetBrains. As I use it now for most of my PHP coding, I also end up editing LESS files with it. And here comes the surprise: PhpStorm has out of the box inbuilt support for LESS! It's not perfect, as it sometimes forgets to display autocomplete suggestions, but overall it's really decent. Like I said, it's not a lightweight solution, and not free of charge either for that matter, but I use it for all of my coding nowadays and find it very recommendable.

Best Answer

PSPad allows you to define "User highlighters". Although not quite as flexible as a full specification, you can at least define all the keywords (up to 3 categories) and reserved words you want highlighted. For LESS, you can get/edit a list of keywords from the existing CSS highlighter in the [Keywords] section from "CSS.DEF" in the "Context" directory inside the PSPad program folder -- you may also expand this list if you simply want support for the CSS3 keywords in the regular CSS highlighter.

You should then assign this user highlighter to one of the "<not assigned>" spots in the Highlighter Settings, following which you can select colours for the reserved words and 3 keyword categories.

With these user highlighters, nested brackets work just fine.

Note: since these files are stored in subfolders of the PSPad program folder, usually in C:\Program Files, Windows Vista and Windows 7 won't let you edit them unless you run PSPad as Administrator. Be sure to do this when you change any settings.

So, in summary:

  • Expand C:\Program Files\PSPad\Context\CSS.DEF for CSS3 properties
  • Create a user highlighter (with keywords from the above file) to be able to have syntax highlighting for LESS