Want more user-defined keywords in Style configuration



  • Hello everyone. In Notepad++/Settings/Style Configuration/Default Theme/C++ Language, there are only two styles which we can add user-defined keywords: INTRUCTION WORD and TYPE WORD.

    It is not colorful enough for me :(

    So, how can I add a CUSTOM STYLE with more user-defined keywords?



  • Without having tested it and with no guarantee it will work, try this:
    Close NPP.
    Find stylers.xml, mine is in the cloud on Dropbox, yours may be in the default location in Programs.
    Back it up someplace.
    Back it up someplace (intentionally duplicated).

    Open the file in NPP and duplicate the line you want to have more choice of, here I use the TYPE WORD in the <LexerType name=“cpp” desc=“C++” ext=""> section:
    <WordsStyle name=“TYPE WORD” styleID=“16” fgColor=“8000FF” bgColor=“FFFFFF” fontName="" fontStyle=“0” fontSize="" keywordClass=“type1” />
    <WordsStyle name=“TYPE WORD” styleID=“16” fgColor=“8000FF” bgColor=“FFFFFF” fontName="" fontStyle=“0” fontSize="" keywordClass=“type2” />

    Notice the type2 class name I have boldly chosen.
    Save and close NPP, start it up again and edit the second instance of TYPE WORD in NPP.

    It may work…



  • @Công-Cà-Cuống

    as you do cpp programming, the sources which needs to be checked are, in your case,
    LexCPP.cxx and ScintillaEditView.cpp.
    The lexer defines what is supported at all and within ScintillaEditView you see what/how npp
    uses it.

    Cheers
    Claudia



  • @ decoderman

    I have tried your solution, but this field styleID=“16”, it seems to be conflicted :)

    It did not word for me :(


Log in to reply