I've recently begun using Notepad++, and have found a part of its styling functionality that confuses me.

I'm currently attempting to color all of PHP's defined functions (such as count(), strlen(), etc.). In the Settings->Style Configurator, you cannot add a new style for such a function list. Instead, I have begun editing the stylers.xml and langs.xml.

To add the new coloring, in langs.xml, I've modified the php section to the following:

<Language name="php" ext="php php3 phtml" commentLine="//" commentStart="/*" commentEnd="*/">
    <Keywords name="instre1">[default keywords]</Keywords>
    <Keywords name="instre2">[my function list]</Keywords>

The [default keywords] and [my function list] are replaced with wordlists.

I've also edited the php section in stylers.xml to look like the following:

<LexerType name="php" desc="php" ext="">
    <WordsStyle name="QUESTION MARK" styleID="18" fgColor="FF0000" bgColor="FDF8E3" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="DEFAULT" styleID="118" fgColor="000000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="STRING" styleID="119" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="STRING VARIABLE" styleID="126" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="1" fontSize="" />
    <WordsStyle name="SIMPLESTRING" styleID="120" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="WORD" styleID="121" fgColor="008040" bgColor="FEFCF5" fontName="" fontStyle="1" fontSize="" keywordClass="instre1">True False</WordsStyle>
    <WordsStyle name="NUMBER" styleID="122" fgColor="FF0000" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="VARIABLE" styleID="123" fgColor="0080FF" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="COMMENT" styleID="124" fgColor="FF8040" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="COMMENTLINE" styleID="125" fgColor="FF8040" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="OPERATOR" styleID="127" fgColor="8000FF" bgColor="FEFCF5" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="FUNCTIONS" styleID="128" fgColor="000080" bgColor="FEFCF5" fontName="" fontStyle="1" fontSize="" keywordClass="instre2"></WordsStyle>

The changed part is the last "FUNCTIONS" line.

When I restart Notepad++ and go into the Settings->Style Configurator section, under the php language, the FUNCTIONS style exists. I can change the style's color, and can see the entire keyword list under 'Default Keywords'. However, it is not changing the coloring of the words in my code.

When I edit the WORD style, which contains stuff like 'if', 'and', and 'true', things change accordingly in my code.

Any ideas on how to make this work?

  • Can you add a screenshot of the Style Configurator? I have a feeling I know what's wrong, but need to see something to be sure. – MBraedley Sep 25 '11 at 0:31

I've got the same problem. There does not seem to be a solution at the moment.

The problem is not related to notepad++, but the Scintilla project.

It is described here.

It is also noted in the ideatorrent.

Seems like we will have to wait for an Update on Scintilla.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.