Skip to content

User Language Definition (userDefineLang)

A User Language Definition (often identified by the XML root tag <UserLang>) is a configuration file used to define syntax highlighting and styling rules for a custom language in Notepad++.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md] These definitions allow users to extend the editor's capabilities to recognize specific file extensions and keywords unique to their development environment.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]

Structure

The definition is encapsulated within a <NotepadPlus> root element.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md] Inside this element, the primary container is the <UserLang> tag, which accepts attributes such as name (the language name) and ext (the associated file extension, e.g., conf).^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]

Internally, the file is divided into two main subsections: <Settings> and <KeywordLists>, followed by style definitions.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]

Settings

The <Settings> block configures the parser's behavior.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md] This includes global options such as case sensitivity (caseIgnored) and the escape character used.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md] It also determines how symbols are treated, such as defining which characters mark line comments or how prefixes are applied to specific keyword groups.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]

Keywords and Symbols

The <KeywordLists> section categorizes specific words and symbols used in the language.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md] Key lists include:

  • Delimiters: Defines the hierarchy of code folding (e.g., { for open and } for close).^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]
  • Operators: Specifies characters used in operations, such as *, ;, [, ], ^, ~, and =.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]
  • Comments: Defines the syntax for comments, typically specifying line numbers and the initiating character (e.g., #).^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]
  • Word Groups: Separate lists (Words1 through Words4) categorize different types of keywords, such as built-in variables, prefixes, directives, and context-specific commands.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]

Styling

The <Styles> section maps the keyword lists and syntactic elements to visual attributes.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md] This includes foreground and background colors (fgColor, bgColor), font styles (fontStyle), and font names for elements like default text, folders, keywords, and comments.^[600-developer-tools-nginx-notepad-color-nginx-notepad-color.md]

Sources

  • 600-developer-tools-nginx-notepad-color-nginx-notepad-color.md
  • [[Notepad++]]
  • [[Syntax Highlighting]]
  • [[Nginx]]