02.6EditorConfig

EditorConfig generator

Tick the languages in your project, adjust any property, and copy the .editorconfig. Then type a path to see exactly which settings an editor will use for that file, and which section each one comes from.

Presets

Language presets

Sections

3 sections

.editorconfig

# EditorConfig: https://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
max_line_length = off

[{Makefile,makefile,GNUmakefile,*.mk}]
indent_style = tab

Matching sections, in order (later ones win): [*] → [*.md]

PropertyValueSet by
indent_stylespace[*]
indent_size2[*]
tab_width2derived from indent_size
end_of_linelf[*]
charsetutf-8[*]
trim_trailing_whitespacefalse[*.md]
insert_final_newlinetrue[*]
max_line_lengthoff[*.md]

How editors read .editorconfig

An editor looks for .editorconfig files from the file’s folder upwards until it finds one with root = true. Within a file, every section whose glob matches applies, in order, and a later section overrides an earlier one, so put [*] first and the specific ones after it.

  • * matches any characters except /; ** matches across folders; ? is one character.
  • [abc] and [!abc] match one character from a set, or not from it.
  • {js,ts} matches any of the listed strings, and {1..12} any whole number in that range.
  • A glob without a /, like *.md, matches files of that name in any folder. With a /, like docs/*.md, it is relative to the folder the .editorconfig is in.

The tester follows those rules. It also fills in what the specification derives: indent_style = tab without a size means indent_size = tab, and a numeric indent_size sets tab_width unless that is given.

Questions

Does my editor support EditorConfig?

Visual Studio, the JetBrains IDEs, Neovim, Vim 9.1, Xcode 16 and GitHub’s web editor read it out of the box. VS Code, Sublime Text and others need the EditorConfig plugin.

Where does the file go?

In your project’s root folder, usually next to .git. A subfolder can have its own .editorconfig to override settings for the files below it.

Is anything sent to a server?

No. The file is generated and tested in your browser.