What is it?

EditorConfig helps developers define and maintain consistent coding styles between different 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.

Thus, even if you switch between editors or you and your team have different favorite code editors, you always follow the same rules.

How to use it?

In order to use it, you need two things:

  • First of all, a file named `.editorconfig` where you specify your coding styles
  • Secondly, a plugin for the code editor or IDE you use. Full list of supported editors can be found here.

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.

My editor Config File

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

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

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

For more details you can visit EditorConfig webiste.

PS:
Special thanks to my friend and colleague Tasos Bekos who told me about this awesome tool.

Categorized in:

Tagged in:

,