Skip to content

EditorConfig

Modular Text Editor honours .editorconfig files, so the editor automatically matches each project's conventions — indentation, line endings, character set, trailing whitespace and final newline — without any manual setup. This is a built-in feature of the editor, not a plugin.

It is silent and automatic: there are no menu commands. The editor reads the .editorconfig files that apply to a file when you open and save it.

How it works

When you open a file, the editor walks up from the file's folder collecting .editorconfig files until it reaches one marked root = true (or the drive root). Rules from the closest file win, and later sections override earlier ones. The resulting settings are applied like this:

  • On openindent_style, indent_size and tab_width are pushed into the document so the Tab key, backspace-unindent and auto-indent all follow the project's convention. A project's .editorconfig takes precedence over your global indent setting (see Auto-pair & indentation ▸ precedence).
  • On save — trailing whitespace is trimmed, the final newline is added/removed, line endings are normalised, and the file is written in the requested character set.

Project settings apply silently but stay overridable: you can always change indentation by hand, and the whole feature can be turned off (see Settings).

Settings

Preferences ▸ General:

  • Apply .editorconfig settings from the project — turn the whole feature on or off (on by default). When off, the editor ignores .editorconfig completely: it neither applies the standard keys nor exposes the per-plugin keys described below.

Supported properties

EditorConfig defines a small, fixed set of properties. The table shows every one and what the editor does with it. Property names and the known values are case-insensitive.

Property Accepted values What the editor does
root true / false (must appear before the first [section]) true stops the search at this file — it is the top-most config.
indent_style tab / space Chooses tabs or spaces for indenting.
indent_size a whole number, or tab Sets how many columns one indent level is (tab follows tab_width).
tab_width a whole number Sets the visual width of a tab; defaults to indent_size.
end_of_line lf / cr / crlf Normalises line endings when saving.
charset latin1 / utf-8 / utf-8-bom / utf-16be / utf-16le Writes the file in this encoding when saving.
trim_trailing_whitespace true / false true removes spaces/tabs at the end of each line on save.
insert_final_newline true / false true ensures the file ends with exactly one newline; false removes trailing newlines.
max_line_length a whole number, or off Recognised but not yet applied.
spelling_language a language code, e.g. en-US Recognised but not yet applied.
any property = unset unset Clears a value set by a broader rule, restoring the editor's own default.

Two properties are read but not yet acted on

max_line_length and spelling_language are part of the EditorConfig standard but are not universally supported by editors. The editor parses them (so they cause no errors) but does not act on them yet.

File matching (globs)

Each [section] header is a glob matched against the file path, relative to the folder containing the .editorconfig:

Pattern Matches
* any characters except a path separator (/)
** any characters, including / (spans folders)
? exactly one character except /
{a,b,c} any one of the comma-separated strings
{1..9} any integer in the range
[abc] any single character in the set
[!abc] any single character not in the set
name a pattern with no / matches in any subfolder
/name a leading / anchors the match to the config file's folder

Per-plugin settings

Besides the standard keys, .editorconfig can also carry per-plugin configuration. A plugin reads its own settings under the namespace mte.<plugin-id>.<key>, and a project value overrides the user's global preference (set in Preferences) for files in that project. This is gated by the same Apply .editorconfig settings toggle above — turn it off and these keys are ignored too.

Available plugin keys

This is the complete list of plugin settings the editor honours from .editorconfig today. It grows only as a plugin explicitly opts in; any key not listed here (including those for plugins that don't read .editorconfig) is parsed but has no effect.

Key Type Default Effect
mte.org.mte.url.enabled true / false the global URL Highlighter toggle (Preferences) Enable or disable URL detection and highlighting for files in this project.

Example — switch URL highlighting off for one project, regardless of the global toggle:

[*]
mte.org.mte.url.enabled = false

Why so few?

Per-plugin keys are intentionally limited to genuine project conventions (settings a team would commit and share). Most plugin settings — search history, autosave intervals, the last-opened folder, OS file associations — are personal or machine state and deliberately do not belong in a shared .editorconfig. The classic project convention, indentation, is covered by the standard keys above. More plugin keys may appear here as plugins adopt the feature.

Example

A .editorconfig placed at a project root, using every property and glob form:

# Top-most config in the project: stop searching parent directories.
root = true

# Defaults for every file in this tree.
[*]
indent_style = space
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# max_line_length and spelling_language are recognised but not yet applied.
max_line_length = 100
spelling_language = en-US

# Makefiles must use real tabs.
[Makefile]
indent_style = tab

# 2-space indent for web/markup/data files (brace alternation).
[*.{js,ts,json,yml,yaml,html,css}]
indent_size = 2

# Markdown keeps trailing whitespace (two spaces = a hard line break).
[*.md]
trim_trailing_whitespace = false

# Windows batch files want CRLF and a legacy code page.
[*.{bat,cmd}]
end_of_line = crlf
charset = latin1

# '**' spans folders; '?' matches one character.
[docs/**.txt]
indent_size = 2
[log/file?.log]
indent_size = 8

# Integer-range and character-class globs.
[page{1..9}.txt]
indent_size = 1
[[Mm]akefile.inc]
indent_style = tab

# A leading '/' anchors to this file's folder only.
[/CHANGELOG.md]
max_line_length = off

# 'unset' clears a value set by a broader rule.
[lib/legacy/*]
indent_style = unset
indent_size = unset

# A plugin's own setting (URL Highlighter), overriding the global toggle here.
mte.org.mte.url.enabled = false

Comments must be on their own line

EditorConfig has no inline comments. A # or ; only starts a comment at the beginning of a line. Writing indent_size = 4 # four makes the value 4 # four, which is invalid and silently ignored — put the comment on the line above instead. (This matches every other EditorConfig-aware editor.)