strict warning: Non-static method view::load() should not be called statically in /data/web/91/e6/41/ on line 879.

User Defined Languages

User defined languages allow you to add your own language to Notepad++. This is a very quick and easy way to do so.

The NpWiki++ page about user defined language files lists all known such languages and allows sharing new contributed files.

Notepad++ always has the main User Defined language available. You can use this to test your settings and then later on create a new language based on this. The User Defined language gets reset each time you restart Notepad++, its settings will not be saved. User defined languages are available from the bottom of the language menu.

To define one, you need the User Defined Dialog, which can be accessed by selecting View->User Define Dialog... or pressing the  button.

The dialog can float like any regular dialog when open, or be docked in the main Notepad++ window. Simply click Dock/Undock to do so. If the dialog is undocked (floating) you can control its transparency. Enable the transparency checkbox and control the amount using the slider. Note that transparency is only available on Windows 2000 and later.

The dialog shows a dropdownlist of the currently defined user languages. Select one to change its parameters, if possible they will be automatically saved. To create a new user language based on the current state of the main User Defined language, click the Create New... button, a dialog will pop up asking for the name. To create a new User language based on the currently selected language, click Save As... and enter the new name. If you have selected an user created language, you can click on the Rename button to enter a new name if necessary, and the Remove button will delete the language.

If you want the user language to ignore the case of the text (so it will be case insensitive when looking for keywords), enable the ignore case checkbox.

For user created languages, you can also define what file extensions to associate with them for language autodetection in the textbox with the Ext label.

Most settings have a certain text style associated with them. These work the same as in the Styler Configurator (see Styler Configurator for details).

Other aspects of the language are controlled by the settings divided in four groups:

Default style and Folding (Folder & Default tab)

This tab control the style of the default text (text that has no special attributes or meaning) and the keywords that control the folding. A keyword in the Folder Open group will trigger a new Fold group that can be expanded and collapsed. A keyword in the Folder Close group will close any opened group.


Keywords (Keywords Lists tab)

This tab controls what keywords are registered with the language. You can define up to four groups of keywords, each with their own style. If you enable the Prefix option for a group, that means that these keywords can be prefixes of entire words, and thus will be detected even if the keyword is directly followed by other text. In that case the other text will be styled the same as the keyword.


Comments/Numbers (Comment & Number tab)

This tab controls the behavior and appearance of comments, and the appearance of numbers. You can define multiple comment symbols that are comment line symbols. These comments run from the symbol itself to the end of the line. You can also define comment block symbols. These symbols start commenting from any comment open symbol, until and comment close symbol is reached.

If you enable the Treat keyword as symbol checkbox, the comment symbols also trigger comments if they are the beginning of a word, much like prefix keywords.

Numbers are only recognized if they start a word with characters ranging from 0-9, where only the number symbols are styled as such.


Operators and Delimiters (Operators tab)

This tab controls what operator symbols exists and what symbols act as delimiters. Operator symbols are characters that split two words. They behave much as whitespace but can be styled differently.

Delimiters are single characters and usually defined in pairs. Any text between a pair of delimiters as styled as such. A good example is a string, which is delimited on both sides with double quotes and drawn in a different color. Since, in many languages, a string may contain the string delimiter with a special prefix, you can enable and choose this prefix, the escape character.


Storing and sharing user define language definitions

Basically, the settings for all user defined languages are stored in a configuration file called userDefineLang.xml. This is handy when you have defined only one language, or when you want to share all of the languages you defined. Because this scheme is too coarse grained at times, you can also

  • Import a language from an external file, as long as it has proper contents. Changes will be saved in your file for all languages.
  • Export an individual language to an .xml file.

Note that the Save As button does not create any new file. It duplicates the current language using a new name you supply. Export does create a new file. Likewise, Create New creates a new language with all attributes reset to default and the name you provide.

Please also note that, if you import a language you already have, you will get duplicate entries in the language list and in the language menu.