相关说明
When opening a file, EditorConfig plugins look for a file named
.editorconfigin the directory of the opened file and in every parent directory. A search for.editorconfigfiles will stop if the root filepath is reached or an EditorConfig file withroot=trueis found.For Windows Users: To create an
.editorconfigfile within Windows Explorer, you need to create a file named.editorconfig., which Windows Explorer will automatically rename to.editorconfig.
配置
Wildcard Patterns
| 通配符 | 说明 |
|---|---|
| * | 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) |
Supported Properties
indent_style: set to tab or space to use hard tabs or soft tabs respectively.
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.
tab_width: a whole number defining the number of columns used to represent a tab character. This defaults to the value of indent_size and doesn’t usually need to be specified.
end_of_line: set to lf, cr, or crlf to control how line breaks are represented.
charset: set to latin1, utf-8, utf-8-bom, utf-16be or utf-16le to control the character set. Use of utf-8-bom is discouraged.
trim_trailing_whitespace: set to true to remove any whitespace characters preceding newline characters and false to ensure it doesn’t.
insert_final_newline: set to true ensure file ends with a newline when saving and false to ensure it doesn’t.
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.
Currently all properties and values are case-insensitive. They are lowercased when parsed. Generally, if a property is not specified, the editor settings will be used, i.e. EditorConfig takes no effect on that part.
It is acceptable and often preferred to leave certain EditorConfig properties unspecified. For example,
tab_widthneed not be specified unless it differs from the value ofindent_size. Also, whenindent_styleis set totab, it may be desirable to leaveindent_sizeunspecified so readers may view the file using their preferred indentation format. Additionally, if a property is not standardized in your project (end_of_linefor example), it may be best to leave it blank.