EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
root
: special property that should be specified at the top of the file outside
of any sections. Set to true
to stop .editorconfig files search on current
file.
root = true
[*]
end_of_line
: set to lf
, cr
, or crlf
to control how line breaks are
represented.
end_of_line = lf
insert_final_newline
: set to true
to ensure file ends with a newline when
saving and false
to ensure it doesn’t.
insert_final_newline = true
charset
: set to latin1
, utf-8
, utf-8-bom
, utf-16be
or utf-16le
to
control the character set.
charset = utf-8
trim_trailing_whitespace
: set to true
to remove any whitespace characters
preceding newline characters and false
to ensure it doesn’t.
trim_trailing_whitespace = true
indent_style
: set to tab
or space
to use hard tabs or soft tabs
respectively.
indent_style = space
indent_size
: a whole number defining the number of columns used for each
indentation level and the width of soft tabs (when supported). When set to
tab
, the value of tab_width
(if specified) will be used.
indent_size = 4
max_line_length
: forces hard line wrapping after the amount of characters
specified.
max_line_length = 80
Set indent_size
to 2
for js
, css
, html
etc.:
[*.{js,css,html,json,tex,yaml,feature}]
indent_style = space
indent_size = 2
Set max_line_length
to 120
for java
and kt
:
[*.{java,kt}]
max_line_length = 120
Use tabs for makefiles.
[{Makefile,**.mk}]
indent_style = tab