23

What's the easiest way to add a custom language to Notepad++ for highlighting support? After some research, I see two ways:

  • User-Defined Language: simple way of adding a new language based on tokens, but can't use the default color scheme (colors are assigned absolutely)?
  • Lexer plugin: A custom C++ plugin implementing a new Scintilla lexer: extremely complex, but tons of flexibility.

Are these it? My one complaint is that with the UDL feature, if I want something to be highlighted, I need to assign it a color; there doesn't seem to be any way to say "use the default keyword color".

Any advice?

jjkparker
  • 955

3 Answers3

9

If you are talking about using the colors based on those set in the Settings > Style Configurator... for the default keyword color...

You can do this by right-clicking on the color in the Colour style section. It will place hatch lines over the color to indicate "use default color".

Npp Screenshot

Now when you change the color theme the theme's color will be used instead of the UDL defined color.

Ryan_S
  • 663
3

It is possible;

I have found an answer that may or may not be helpful depending on how much time you currently have. I found out that in ©Notepad++, you can define your own unique format of a language and have it highlighted however you please, on the contrary of having to input all that you would have to do, it may be a very time consuming and tedious process. However here are the instructions:

1.) 'View' > 'User Defined Language'> Create New > [NAME] > Enter

For version 6.1.2 and later,

2.) 'View' > 'User Defined Dialogue' (presented with wizard/dialogue)

After that you must read my source of this information for adding your own techniques etc. and may the best of luck be with you!


Source(s):

weblogs.asp.net

1

There is an easy way.

Take a look here: http://www.macroquest2.com/wiki/index.php/Notepadplusplus_Syntax_File

Use http://www.w3schools.com/tags/ref_colorpicker.asp to get the "color string" (RGB hex color number) by clicking on the left grid for the color, on the right for the shade of that color, and the color itself with its "string" on the bottom.

In the notepad++ userDefinedLang.xml there's a section for setting the colors as desired:

<Styles>
    <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="KEYWORD1" styleID="5" fgColor="0080FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="KEYWORD2" styleID="6" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="1" />
    <WordsStyle name="KEYWORD3" styleID="7" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="1" />
    <WordsStyle name="KEYWORD4" styleID="8" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="COMMENT" styleID="1" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="COMMENT LINE" styleID="2" fgColor="008040" bgColor="FFFFFF" fontName="" fontStyle="1" />
    <WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
    <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
</Styles>
pashute
  • 191