参考资料:git
# EditorConfig is awesome: http://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
[**] indent_style=space indent_size=2 # tab_width=2 end_of_line=lf charset=utf-8 trim_trailing_whitespace=false insert_final_newline=true root=true
位于[]
内的字符串指示其下方属性的应用范围。github
该字符串由普通字符与下列通配符组成:json
*
:匹配任何字符串,除了路径分隔符(/)。**
:匹配任何字符串?
:匹配任何单个字符[name]
:匹配任何单个字符name
[!name]
:匹配任何不是name
的单个字符{s1,s2,s3}
:匹配字符串s1
、s2
或s3
{num1,num2}
:匹配num1
至num2
之间的整数缩进方式。候选值:windows
space
:空格hard-tabs
:制表符一个缩进级别的空格数。候选值:ide
tab
:使用属性tab_width
的值一个缩进级别的列数。通常无需指定。候选值:编码
换行符。候选值:spa
lf
:Linux 换行符 \n
cr
:macOS 换行符 \r
crlf
:windows 换行符 \r\n
编码格式。候选值:code
latin1
utf-8
utf-8-bom
(不建议使用)utf-16be
utf-16le
除去行尾的任意空白字符。候选值:ip
true
:启用false
:停用确保文件以一个空白行结尾(若必要则添加)。候选值:utf-8
true
:启用false
:停用支持EditorConfig的IDE会安装目录从里往外的顺序搜索匹配.editorconfig
文件。
属性root
指示是否继续向上搜索匹配。候选值:
true
:搜索匹配到本级目录为止false
:继续向上级搜索匹配以#
或;
开头的整行是注释,IDE不解析。