Syntax colouring¶
The editor colours source code according to its language, making structure easy to read at a glance. Colouring is powered by Lexilla, so a wide range of languages is supported out of the box.
How it works¶
A colorizer identifies the language and tags each token (keyword, string, comment, number, type, …); a theme maps each token category to a colour. Because every language speaks the same set of categories, switching the theme recolours all of them at once.
Choosing the language¶
The language is detected automatically when you open a file, in this order:
- An extension override you set in Preferences ▸ Syntax Colouring.
- An exact file-name match (e.g.
Makefile,.gitignore). - The file's extension.
- A first-line marker (e.g. a
#!shebang or<?xml).
Use the Language menu to override the detected language for the current document when the automatic choice isn't what you want.
Settings¶
Preferences ▸ Syntax Colouring lets you:
- Choose the active theme (and, with the Theme Editor, create or edit themes).
- Toggle whole token categories on/off (e.g. turn off comment colouring) so they fall back to the default text colour.
- Set extension overrides to force a file type to a specific language.
- Set the maximum file size to colour, in KB. The default is 16384
(16 MB): above that a file opens as plain text, and code folding — which
takes its levels from the same pass — goes with it. Colouring is computed
for the visible page first and for the rest of the file in the background,
so even a multi-megabyte file opens without a pause; typing in it is
unaffected too, because the editor re-colours only around the change. Set
it to
0to remove the limit entirely. The limit exists as a memory safeguard: the lexer keeps style and fold data for every byte it has coloured, so on very large files that is what the ceiling bounds — not speed.
Colouring and code intelligence are independent
Being over the size limit — or turning colouring off altogether — no longer disables the language server for that file. It keeps its diagnostics, navigation and completion; it just is not painted.
Add your own languages and themes
Colorizers and themes are plain JSON files you can edit or add without
rebuilding — drop them in your user config directory and they override or
extend the shipped set. The colorizer file also owns each language's
extensions, keywords and token-style mapping. A theme file may carry an
optional attribution block (authors, copyright, licence, notice); the
editor ignores it for rendering and keeps it unchanged when it saves the
theme.