EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.

What's an EditorConfig file look like?

(A formal specification of EditorConfig is also available.)

Example file Below is an example .editorconfig file setting end-of-line and indentation styles for Python and JavaScript files. # EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true # Matches multiple files with brace expansion notation # Set default charset [*.{js,py}] charset = utf-8 # 4 space indentation [*.py] indent_style = space indent_size = 4 # Tab indentation (no size specified) [Makefile] indent_style = tab # Indentation override for all JS under lib directory [lib/**.js] indent_style = space indent_size = 2 # Matches the exact files either package.json or .travis.yml [{package.json,.travis.yml}] indent_style = space indent_size = 2 Check the Wiki for some real-world examples of projects using EditorConfig files.

Where are these files stored? When opening a file, EditorConfig plugins look for a file named .editorconfig in the directory of the opened file and in every parent directory. A search for .editorconfig files will stop if the root filepath is reached or an EditorConfig file with root=true is found. EditorConfig files are read top to bottom and the most recent rules found take precedence. Properties from matching EditorConfig sections are applied in the order they were read, so properties in closer files take precedence. For Windows Users: To create an .editorconfig file within Windows Explorer, you need to create a file named .editorconfig. , which Windows Explorer will automatically rename to .editorconfig .

File Format Details EditorConfig files use an INI format that is compatible with the format used by Python ConfigParser Library, but [ and ] are allowed in the section names. The section names are filepath globs (case sensitive), similar to the format accepted by gitignore. Only forward slashes ( / , not backslashes) are used as path separators and octothorpes ( # ) or semicolons ( ; ) are used for comments. Comments should go on their own lines. EditorConfig files should be UTF-8 encoded, with either CRLF or LF line separators. EditorConfig files are read top to bottom and the most recent rules found take precedence. Filepath glob patterns and currently-supported EditorConfig properties are explained below.

Wildcard Patterns Special characters recognized in section names for wildcard matching: * Matches any string of characters, except path separators ( / ) ** Matches any string of characters ? Matches any single character [name] Matches any single character in name [!name] Matches any single character not in name {s1,s2,s3} Matches any of the strings given (separated by commas) (Available since EditorConfig Core 0.11.0) {num1..num2} Matches any integer numbers between num1 and num2, where num1 and num2 can be either positive or negative Special characters can be escaped with a backslash so they won't be interpreted as wildcard patterns.