Built-in Languages

From Notepad++ Wiki
Jump to: navigation, search
Languages with built-in (Scintilla provided) highlighting support


The list

The following 52 languages are natively supported by Notepad++: as of version 6.6.6:

  • ActionScript
  • ADA
  • asp
  • Assembly
  • autoIt
  • bash
  • Batch
  • C
  • C++
  • C#
  • Caml
  • CMakeFile
  • Cobol
  • Coffee script
  • CSS
  • D
  • DIFF
  • Flash ActionScript
  • Fortran
  • Gui4CLI
  • Haskell
  • HTML
  • ini file
  • InnoSetup
  • Java
  • Javascript
  • JSP
  • KiXtart
  • LISP
  • Lua
  • Makefile
  • Matlab
  • NSIS
  • Objective-C
  • Pascal
  • Perl
  • php
  • PowerShell
  • Postscript
  • Properties file
  • Python
  • R
  • RC
  • Ruby
  • Scheme
  • Shell
  • Smalltalk
  • SQL
  • TCL
  • TeX
  • VB / VBS
  • Verilog
  • VHDL
  • XML
  • YAML

This means that the highlightig for these languages is contained in langs.xml and stylers.xml, and modifiable using the Settings -> Styler Configurator... dialog.

Using the Styler Configurator

All the styles (colour & font) are configurable via the Styler Configurator dialog via Settings -> Styler Configurator.... A complete set of such configuration data for all built-in languages, as well as many global features, is known as a theme file. You can choose from a variety of bundled theme files from the top dropdown list. Additionally, the Settings -> Import -> Import style theme command gives you the ability to import a theme on the fly. The bundled styler.xml is just the default theme file, and choosing a theme simply means using another file with the same layout. More details in Configuration Files.

The Configurator dialog is modeless, which means you can switch focus to the editor window to scroll or type. Since the changes made in the Configurator are immediately displayed, you can verify that the results look as expected. In case of a mistake, hit Cancel to revert to the original settings. If making large-scale changes, it's a good idea to Save & Close frequently as you make progress on getting the style the way you want it, or you may find yourself repeating a lot of work after reverting from a mistake.

Global styles

Global styles are used to set the overall appearance of the editing window. Typically you will set the Global Overrides with your preferred unstyled colors and font, and specify which of those settings you want to override the lexer-specific settings. Recommended: select

  • Enable global background colour
  • Enable global font

Most of the rest of the global style elements only specify colours (foreground or background or both), and these apply regardless of the global-colour override settings. (The exception is brace highlighting; both "Brace Highlight Style", used for coloring matching braces, and "Bad Brace Colour", used for a mismatched brace, specify colors and font, all of which may be overridden.)

Under Global Styles, it's also a good idea to set the Default Style to match the settings in the Global Override style.

In addition to styling the contents of the editor window, there are global styles for the functional margins—line number, fold—and the presentation of the tabs.

Language-specific styles

Each language has its own lexer, which performs the styling for that language. Different lexers expose different names for the various styled elements; for instance, C and related lexers have COMMENT and COMMENT LINE, while Python has COMMENTLINE. To make changes, select the language you wish to style, and determine which element style is the one you need to change. (The element name may not be obviously related to the element, so be prepared to experiment.)

Most lexers have a list of keywords recognized for styling (when outside of a string or comment), and in most cases these are extensible. (One glaring exception to this is the HTML, in which the list of tags is fixed.) To extend the list, select the element (e.g., for the C lexer, select TYPE WORD). The dialog displays the list of Default keywords (which are built-in), and provides a User-defined keywords field.

Tab settings

Language specific tab settings (tab widths, and whether to use tab characters or fill with spaces) are configured from the Language menu/Tab settings tab in the Preferences dialog.

System fonts

Notepad++ reads the list of available fonts at startup. When installing a new font, Notepad++ won't update its font-selection lists until it is next started.

Language properties

(review now that a major Scintilla upgrade has taken place)

While the built-in lexers cannot be modified directly, as they are compiled into ScoLexer.dll, they may allow for some configurable behaviour. The following is a list of such properties, with a short description and precise name, for each language Notepad++ supports that has such configurable features. We'll call them properties, because this is how Scintilla internally calls them.

Properties have default values, and Notepad++ sometimes overrides it. The default value of each and every property is reported, and notepad++ overrides are reported as well.

How to set up a property

The diehard geek way is to send a Windows message to the current Scintilla child window.

Since this is not something an average user is supposed to do, we'll show examples that do the exact (well almost) same thing in a more civilised way: setting the property "example.text.block.comment" to 1. Properties typically get values of 1 or 0, but the newer versions of Scintilla may venture into other sorts of values. Scintilla can accept any string, and any sort of value can be turned into a string - it is up to the lexer to decide if it can do anything with the retrieved string.

Using a macro

In shortcuts.xml, right before the </Macros> closing tag, insert the following:

<Macro nam="setExampleProperty" Ctrl="yes" Alt="yes" Shift="no" key="100">
    <Action type="1" message="4004" wParam="example.text.block.comment" lParam="0" sParam="1"/>
<Macro>

This macro uses the same conventions as all the synthetic Macros scattered around NpWiki++, and binds to Ctrl-Alt-NumPad4. For an explaination, see Macros in shortcuts.xml. The advantage of this technique is that it doesn't require any extra plugin nor much programming knowledge. The drawback is that you need to fire the macro every time you change the active document language, and that you need to do it for both views if you use them both.

Using the NppExec plugin

1/ Using the Exeecute... function of NppExec, create a script with just this line:

sci_sendmsg SCI_SETPROPERTY "example.text.block.comment" "1"

Save to, say testproperty.whatever. 2/ On the Advanced options... dialog of NppExec, select your script in the upper right dropdown titled "Execute this script when Notepad++ starts". Or you may wish to assign running this script to a hotkey. Just check what the dialog can offer you.

Using the Python Scripting plugin

Use the setProperty method of the editor (Scintilla) object:

editor.setProperty('example.text.block.comment', '1')

If you want to set the property for both views (for instance when Notepad++ starts, add the code to your startup.py file):

editor1.setProperty('example.text.block.comment', '1')
editor2.setProperty('example.text.block.comment', '1')

editor always refers to the current view - editor1 always refers to the first and editor2 always to the second.

Using the NppScripting / Zen Coding plugin
Using the PHP Automation plugin

It is not certain PHP Automation can do this, since Scintilla related functions re grouped by topic and there is none relating to lexers. The following could be a valid script:

<?php
sciLexer("SCI_SETPROPERTY","example.text.block.comment","1");
?>

but it will not work as-is under v1.09.

Using the SimpleScript plugin

Soerrry, this plugin is ANSI only and wraps only a limited subset of what Notepad++ and Scintilla can do. So you cannot set a Scintilla property with v1.13, the latest version.

From a plugin in C++
NppData _nppData; //initialised by NP++
// ....
char propName[] = "example.text.block.comment";
char valueString[] = "1";
::SendMessage(_nppData[1], SCI_SETPROPERTY, &propName, &valueString);
::SendMessage(_nppData[2], SCI_SETPROPERTY, &propName, &valueString);

(this sets both Scintllas, keep only one of th last two statements if you don't wish to affect the other Scintilla).

Language properties

ASM
fold
Set to 1 to enable folding (default, notepad++ override), else 0.
fold.asm.comment.explicit
Set to 1 to fold on explicit folding points for comments, else 0 (default). Folding points start with ;{ and end with ;}
fold.asm.comment.multiline
St to 1 to fold on multiline comments, else 0 (default).

fold.asm.explicit anywhere

Set to 1 to fold on explicit folding outside comments, else 0 (default).
fold.asm.explicit.end
Alternate end string for explicit folding, default to "".
fold.asm.explicit.start
Alternate start string for explicit folding, default to "".
fold.asm.syntax.based
Set to 1 (default) to enable folding based on syntax, else 0.
fold.compact
St to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
lexer.asm.comment.delimiter
Alternate delimiter in the COMMENT directive, defaults to 0.
AutoIt 3
fold.comment
This is either 0 not to fold on comments, 1 (default, notepad++ override) to fold or 2 to fold ion keywords nside comments.
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
fold.preprocessor
Set to 1 (default, notepad++ override) to fold preprocessor directives, 0 not to.
Bash
fold.comment
Set to 1 (default, notepad++ override) to fold on comments, else 0.
fold.compact
Set to 1 for blank lines following ao folded block to fold as well, else 0 (default, notepad++ override).
Basic
fold
Set to 1 (default, notepad++ override) to enable folding, ele 0.
fold.basic.comment.explicit
Set to 1 to fold on explicit foldable comments, else 0 (default). Explicit folding is marked with ;{ and ;} in Blitz/PureBasic, '{ and '} in FreeBasic.
fold.basic.explicit.anywhere
Set to 1 to enable explicit fold points anywhere, else 0 (default).
fold.basic.explicit.end
Akternate end string for explicit fold points, defaults to "".
fold.basic.explicit.start
Alternate start string for explicit folding points, defaults to "".
fold.basic.syntax.based
Set to 1 (default) to enable syntax based folding, else 0.
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
C++
fold
Set to 1 (default, notepad++ override) to enable foldin, else 0.
fold.at.else
Set to 1 (default) to fold on else statemetns, else 0.
fold.comment
Set to 1 (default, notepad++ override) to enable folding on multiline and explicit comment folders, else 0. Such comments start with //{ and finish with //}.
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, norepad++ override).
fold.cpp.comment.explicit
Set to 1 (default) to fold on explicit foldable comments, else 0.
fold.cpp.comment.multiline
Set to 1 (default) to fold on multiline comments, else 0.
fold.cpp.explicit.anywhere
Set to 1 to enable explicit fold points anywhere, else 0 (default).
fold.cpp.explicit.end
Alternate end string for explicit fold points, defaults to "".
fold.cpp.explicit.start
Alternate start string for explicit folding points, defaults to "".
fold.cpp.syntax.based
Set to 1 (default) to enable syntax based folding, else 0.
fold.preprocessor
Set to 1 (default, notepad++ override) to fold on preprocessor directives, else 0.
lexer.cpp.allow.dollars
Set to 1 (default) to allow $ in identifiers, else 0.
lexer.cpp.hashquoted.strings
Set to 1 to use # as string quote character, else 0.
lexer.cpp.track.preprocessor
Set to 1 to grey out inactive code, else 0 (default, notepad++ overrides). Incorrect detection is reported when symbols are not defined in the same file.
lexer.cpp.triplequoted.strings
Set to 1 to enable highlighting of triple quoted stings, else 0 (default).
lexer.cpp.update.preprocessor
Set to 1 (default) to update greying out data on encountering #(un)define dirctives, else 0.
styling.within.preprocessor
Set to 1 to style only the initial # and directive, 0 (default) to styl the whole directive.
Caml
lexer.caml.magic
Set to 1 to recognise @rc read-only comments, else 0 (default).
Cmake
fold
Enable folding if set to 1 (default, notepad++ override), disable if 0.
fold.at.else
Set to 1 to fold on else statements, else 0 (default).
Cobol
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
CoffeeScript
fold.comment
Set to 1 to fold comment blocks, else 0.
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
lexer.cpp.allow.dollars
Set to 1 to allow the $ sign in identifiers, else 0.
styling.within.preprocessor
Set to 1 to keep highlighting identifiers inside preprocessor directives, else 0.
CSS
fold.comment
Fold on comment if set to 1(default, notepad++ override), else set to 0 .
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
lexer.xss.hss.language
Set to 1 to recognise extra constructs in HSS, else 0.
lexer.xss.less.language
Set to 1 to recognise extra constructs in LESS, else 0.
lexer.xss.scss.language
Set to 1 to recognise extra constructs in SCSS, else 0.
D
fold
Set to 1 (default, notepad++ override) to enable folding, else 0.
fold.at.else
Set to 1 to fold else statements, ese 0 (default)
fold.comment
Fold on comment if set to 1 (default, notepad++ override)), else set to 0.
fold.compact
Set to 1 for blank lines following a folded block to fold as well,else 0 (default, notepad++ override).
fold.d.comment.explicit
Set to 1 (default) to enable explicit fold points at line comments, else 0.
fold.d.coment.multiline
Set to 1 (default) to fold on multilin comments, else 0.
fold.d.explicit.anywhere
Set to 1 to fold on explicit foldpoints anywhere, else 0 (default).
fold.d.explicit.end
Set to alternate fold closer point string, defaults to "". Standard is //}.
fold.d.explicit.start
Set to alternate fold opener point string, defaults to "". Standard is //{.
fold.d.syntax.based
Set to 1 (default) to enable folding based on syntax, else 0.
lexer.d.fold.at.else
Set to 1 to fold on } else {, 0 to disable, -1 (default) to tie to fold.at.else.
Fortran
fold.comment
Set to 1 (default, notepad++ override) to fold on comments, else 0.
fold.compact
Set to 1 for blank lines following a folded block to fold s well, else 0 (default, notepad++ override).
Gui4CLI
fold.compact
Set to 1 for blank lines following a folded block to fold s well, else 0 (default, notepad++ override).
Haskell
fold
Set to 1 to enable folding, else 0.
fold.comment
Set to 1 to enable folding comment blocks, else 0.
fold.compact
Set to 1 to fold empty lines tht follow a level into that level, else 0.
fold.haskell.imports
Set to 1 to fold import sections, else 0.
lexer.haskell.allow.hash
Set to 1 to allow the hash sign, else 0.
lexer.haskell.allow.questionmark
Set to 1 to allow the question mark, else 0.
lexer.haskell.allow.quotes
Set to 1 to allow quotes, else 0.
lexer.haskell.cpp
Set to 1 to allow embedded C preprocessor directives, else 0.
lexer.haskell.import.safe
Set to 1 to enable the safe keyword in imports, else 0.
styling.within.preprocessor
Set to 1 to keep styling within preprocessor directives, else 0.
HTML / XML / PHP / ASP / JS
asp.default.lnguage
Default script language for ASP: 1 (default) is Javascript, 2 is VBS, 3 is ÿthon.
fold
Set to 1 (default, notepad++ override) to enable folding, else to 0.
fold compact
Set to 1 for blank lines following a folded block to fold as wel, else 0 (default, notepad++ override).
fold.html
Set to 1 (default, notepad++ override) to enable folding of HTML/XML, else to 0.
fold.html.preprocessor
Set to 1 (default) to enable folding of embedded scripts, else to 0.
fold.hypertext.comment
Set to 1 (default, notepad++ override) to enable folding of comments in embedded scripts, else 0.
fold.hypertext.heredoc
Set to 1 t alof folding heredoc strings in scriopts, else 0 (default).
html.tags.case.sensitive
Set to 1 to cause case sensitive matching, else to 0 (default).
lexer.html.django
Allow extra tags from the Django language if set to 1, else set to 0 (default).
lexer.html.mako
Allows extra tags from the Mako language if set to 1, else 0 (default).
lexer.xml.allow.scripts
Set to 1 (default) to allow highlighting of embedded scripts in HTML, else 0.
Lua
fold compact
Set to 1 for blanl lines following a folded block to fold as well, else 0 (default, notepad++ override).
Nsis
fold
Enable folding if set to 1 (default, notepad++ override), else 0.
fold.at.else
else statements are folding points if set to 1, else 0.
nsis.ignorecase
Set to 1 to make the language case insensitive, else 0 (default).
nsis.foldutilcmd
Set to 1 to fold on ifdef and macro definitions, else 0 (default).
nsis.uservars
Set to 1 to highlight user variables, else 0 (default).
Objectie C
fold
Set to 1 (default, notepad++ override) to enable folding, else 0.
fold.comment
Set to 1 (default, notepad++ override) to fold on comments, else 0.
fold.compact
Set to 1 (default, notepad++ override) for blank lines following a folded block to fold as well, else 0.
fold.preprocessor
Set to 1 (default, notepad++ override) to fold preprocessor directives, else 0.
styling.within.preprocessor
Set to 1 to style only the initial # and directive name as preprocessor material, else 0 (default).
Batch, Ini files, Error lists, PO, LATeX, Diff, Property files, Makefile
fold
Set to 1, notepad++ override) to enable folding, else 0 (default, notepad++ override).
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
lexer.props.allow.initial.spaces
Set to 1 to allow coments not to start at the first column, else 0 (default).
lexer.errorlist.value.separate
Set to 1 to style an error list line using 2 styles, else 0 (default)
Pascal
fold.comment
Set to 1 (default, notepad++ override) to fold on comment, else 0.
fold.compact
Set to 1 to cause blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
fold.preprocessor
Set to 1 'defult, notepad++ override) to fold preprocessor directives, else 0.
lexer.pascal.smart.highlighting
Set to 1 (default) to refine highlighting of property and export statements, else 0.
Perl
fold
Set to 1 to enable folding, else 0 (default).
fold.comment
Set to 1 (default, notepad++ override) to fold on comment, else 0.
fold.compact
Set to 1 to cause blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
fold.perl.at.else
Set to 1 to enable folding on a "} else {"-like line, else 0 (default).
fold.perl.comment.explicit
Set to 1 (default) for folding on comments, else 0.
fold.perl.package
Set to 1 (default) to fold on package start, else 0.
fold.perl.pod
Set to 1 (default) to fold on pod start, else 0.
PostScript
fold.at.else
Set to 1 to fold on else statements, else 0 (default).
fold.compact
Set to 1 to cause blank lines following a folded block to fold as well, else 0 (defaut, notepad++ override).
ps.level
Set to 3 (default) to recognise all word lists. 1 or 2 are more restrictive, accptable values.
ps.tokenize
Set to 1 to enable highlighting tokns, else 0 (default).
PowerShell
fold.at.else
Set to 1 to fold on else statements, else 0 (default).
fold.comment
Set to 1 (default, notepad++ override) to fold on comment, else 0
fold.compact
Set to 1 to cause blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
Python
fold.compact
Set to 1 to allow blank lines following a folded block to fold as well, else 0 (default, notepad++ override)
fold.comment.python
Set to 1 to allow folding on comments, else 0 (default).
fold.quotes.python
Set to 1 to fold on triple quoted strings, else 0 (default).
lexer.python.keywords2.no.sub.identifiers
Set to 1 to prevent the highlighting of keywords that appear as sub-identifiers; else 0.
lexer.python.literals.binary
Set to 1 (default) if numbers can start with 0 in binary or octal representation, else 0.
lexer.python.strings.b
Set to 1 (default) to enable b/B binary strings, else 0.
lexer.python.strings.over.newline
Set to 1 for strings to split across lines, else 0 (default).
lexer.python.strings.u
Set to 1 (default) to allow unicode u/U strings, else 0
tab.timmy.whinge.level
Set between 0 (default) and 4 to control the strictness of indentation consistency cotrol.
R
fold.at.else
Set to 1 to fold else statements, else 0 (default).
fold.compact
Set to 1 to cause blak lines following a folded block to fold too, else 0 (default, notepad++ override).
Ruby
fold.comment
Set to 1 (default, notepad++ override) to fod comments, else 0.
fold.compact
Set to 1 to cause blak lines following a folded block to fold too, else 0 (default, notepad++ override).
Search results
fold.compact
Set to 1 to cause blak lines following a folded block to fold too, else 0 (default, notepad++ override).
SQL

Please note that whether the backslash escapes characters is controlled by a specific Settings -> Preferences -> MISC -> Backslash is esacpe character for SQL option.

fold
Set to 1 (default, notepad++ override) to enable folding, else 0.
fold.comment
Set to 1 (default, notepad++ override) to fold on comments, else 0.
fold.compact
Set to 1 for blank lines following a folded block to fold as well, else 0 (default, notepad++ override).
fold.sql.at.else
Set to 1 to recognise ELSE and ELSIF as folding points, else 0.
fold.sql.only.begin
Set to 1 to fold only the beginning of a conditional block, else 0 (default) (default).
lexer.sql.allow.dotted.word
Set to 1 for keywords using a dot to be recognised (PL/SQL), else 0 (dfault).
lexer.sql.backticks.identifier
Set to 1 to allow back quotes to be used as quotation marks, else 0 (default).
lexer.sql.fold.at.else
Set to 1 to fold at ELSE statements, else 0 (default).
lexer.sql.numbersign.comment
Set to 1 for a line starting with # to be a comment, else 0 (dfault).
sql.backslash.escapes
Set to 1 (default, notepad++ override) to allow \ to escape characters, else to 0 (default).
TCL
fold.comment
Set to 1 to fold comments, else 0 (default).
TeX
fold.comment
Set to 1 (default, notepad++ override) to fold comments, else 0.
fold.compact
Set to 1 to cause blank lines following a folded block to fold as well, else 0 (default, ,otepad++ override).
lexer.tex.auto.if
Set to 1 (default) for the automatic new if on command feature, else 0.
lexer.tex.comment.process
Set to 1 for text in comments to be parsed and colourised, else 0 (default)
lexer.tex.interface.default
Set to 1 (default) to get the default word list, else 0.
lexer.tex.use.keywords
Set to 1 to use an extra keyword list, else 0.
User defined languages
fold
Set to 1 (default, notepad++ override) to enable folding, else 0.
userDefine.allowFoldOfComments
Set to 1 to enable comment folding, else 0.
userDefine.currentBufferID
Holds the current document identifier.
userDefine.foldCompact
Set to 1 to fold empty lines that follow a level with that level, else 0.
userDefine.forcePureLC
Used internally to sort out comment marks from delimiters
userDefine.isCaseIgnored
Set to 1 to match keyword case insensitive, else 0 (default).
userDefine.prefixKeywordsn (n between 1 and 8)
Keywords in group n match as prefix when set to 1, otherwise 0 (default).
userDefine.udlName
Holds the name of the language currently used for lexing.
Verilog
fold.at.else
Set to 1 to enable folding on else statements, else 0 (default)
fold.comment
Set to 1 (default, notepad++ override) to fold on comments , else 0
fold.compact
Set to 1 for blank lines following a folded block to be folded too, else 0 (default, notepad++ override).
fold.preprocessor
Set to 1 (default, notepad++ override) to fold on preprocessor directives, else 0.
fold.verilog.flags
Set to 1 to fold module data, else 0 (default).
VHDL
fold.at.Begin
Set to 1 (default) to fold on the begin keyword, else 0.
fold.at.else
Set to 1 (default) to enable folding on else statements, else 0.
fold.at.Parenthese
Set to 1 (default) to fold on parentheses, else 0
fold.comment
Set to 1 (default, notepad++ override) to enable folding on comments, else 0.
fold.compact
Set to 1 for Scintilla to treat blak lines following a folded block as part of the block, else 0 (default, notepad++ override).
YAML
fold.comment
Set to 1 (default, notepad++ override)) to enable folding on comments, else 0.


Note: Scintilla recommands that lexer properties are formatted as "lexer.<language name>.whatever.they.cover". Probably for historical reasons, and notably for folding properties, this hasn't been enforced consistently.