Notepad++ Mod Manager Language

From TNG_Wiki
Jump to: navigation, search

Syntax-highlighting is a text editor feature in which different text colors are used to identify various syntactic element of a file (typically a computer language). It is distinctly useful for detecting and preventing syntax errors.

Notepad++, a powerful Windows-only text editor, has built-in syntax-highlighting rules for upwards of 50 computer languages. It also supports user-defined syntax-highlighting rules.

Notepad++ calls a set of syntax-highlighting rules a "language", and files that hold syntax-highlighting rules are "language files". Confusingly, Notepad++ "languages" do not have a 1:1 correspondence with "computer languages", because different rulesets, perhaps with different color schemes, can be applied, at different times, to any particular one computer language. To alleviate the confusion over the meaning of "language" in TNG, this article will generally refer to "language files" (meaning a stored set syntax-highlighting rules) and "computer languages".

TNG programmers have created two Notepad++ language files to control syntax highlighting for TNG Mod Manager .cfg files. The two language files have different color schemes, and one of the language files is for TNGv8-v11, while the other is for TNGv12 and above. (In truth, both language files can be used with any version of TNG, but the TNGv8-v11 language file cannot highlight the Mod Manager keywords that were introduced in TNGv10.1 and TNGv12.)

Downloading

In both cases, you will need to extract an XML file from the zip archive. The location where you ultimately save your XML file will depend on the version of Notepad++ you are running.

Installation

Note that the instruction below are different for older and newer versions of Notepad++. The XML file you intend to use does not affect the instructions.

Notepad++ v6 and beyond (2014 and later)

  1. Save the XML file anywhere on your computer; perhaps in your downloads folder.
  2. In Notepad++
    1. Select Language / Define your language from the drop-down menus.
    2. On the pop-up form, just click on the Import button near the top.
    3. If necessary, navigate to the folder in which you stored your XML file.
    4. Select the XML file that you just saved.
    5. Close the language definition form.

Notepad++ 5.9.6.2: (downloaded before 2014)

  1. Save the the XML file to Desktop >> User >> AppData >> Roaming >> Notepad++, which is generally c:\home\{your username}\AppData\Roaming\Notepad++.
  2. In Notepad++
    1. Select View / User-Defined Dialog.
    2. Click the Import button on the User-Defined Language screen.
    3. Select the XML file that you just saved.
      The Open dialog should default to the folder in which you saved the XML file. If it does not, you'll have to navigate to it.

Files that are open for editing within Notepad++ when you install a language file will most likely not automatically take on the new highlighting; you'll need to close them and re-open them. In some cases, you may even need to close and reopen Notepad++.

TNGv12 Syntax Highlighting

TNG version: 12.0.0

The screen clip below illustrates that:

  1. All keywords in the .cfg file heading are blue, whether they existed before TNGv12 or not. (Lines 1-6)
    The word "description" in line 3 is highlighted as though it were a keyword. Mod Manager knows that all of its keywords must be preceded with a percent sign, but the Notepad++ Mod Manager language does not.
  2. Percent signs and colons, which are Mod Manager delimiters, are bold and brown, with a pale background. (Lines 1-6,16,etc.)
    As with the word "description" above, percent signs and colons are highlighted even when they are not serving as Mod Manager delimiters.
    The percent sign at the end of the %author directive is not highlighted. I don't know why.
  3. The keyword target and the target filename have a bright yellow background. (Lines 13&36)
    Note that the percent sign and keyword within the target directive are not highlighted in brown.
  4. location, insert, and replace (and their variations) are red. (Lines 16,19,29,32)
  5. end, and the before and after arguments for insert tags, are blue. (Lines 18,19,25,etc.)
  6. The new TNGv12 conditional keywords (e.g. fileexists and textexists) are green. (Line 38)
  7. The new TNGv12 label keyword is green with a light brown background. (Line 41,52)

[Small <--> Full size image]
TNGv12 Syntax Highlighting screen clip[Hide screen clip] TNGv12 Syntax Highlighting screen clip[Hide screen clip]
[Small<-->Full size image]

Pre-TNGv12 Syntax Highlighting

TNG version: 11.1.2

The Notepad++ screen shot below illustrates that:

  1. The mod description is highlighted with a yellow background
  2. Percent signs and colons, which are Mod Manager delimiters, are shown in orange, even when they are not serving as delimiters. (See the text added at the end of line 14, just to illustrate this point.)
  3. Keywords in the mod's heading and the "Target" keyword are shown in green text - see lines 2, 3, 21, and 30. (But the "wikipage" keyword is not highlighted, because it was introduced to Mod Manager after the highlighting rules were defined.)
  4. Other keywords are shown in red-orange text - see lines 23, 24, 33, and 44
    (Note that the keyword "parameter" is highlighted in line 16 even though it is not being used as a Mod Manager keyword there. Mod Manager knows that all of its keywords must be preceded with a percent sign, but the Notepad++ Mod Manager language does not.
  5. Other keywords (insert, replace, triminsert, trimreplace) are shown in pink text - see line 36

[Small <--> Full size image]
Pre-TNGv12 Syntax Highlighting screen clip[Hide screen clip] Pre-TNGv12 Syntax Highlighting screen clip[Hide screen clip]
[Small <--> Full size image]

Related Links

Notepad++

Mod Manager

Mod Manager Controls

For Mod Developers

Technical

Developer Tools

  • Notepad++ Mod Manager Language

Example Mods