editorconfig常用配置

editorconfig常用配置

Youkun 83 2023-02-16 2023-02-16

editorconfig常用配置

*                匹配除/之外的任意字符串
**               匹配任意字符串
?                匹配任意单个字符
[name]           匹配name中的任意一个单一字符
[!name]          匹配不存在name中的任意一个单一字符
{s1,s2,s3}       匹配给定的字符串中的任意一个(用逗号分隔) 
{num1..num2}    匹配num1到num2之间任意一个整数, 这里的num1和num2可以为正整数也可以为负整数

indent_style    设置缩进风格(tab是硬缩进,space为软缩进)
indent_size     用一个整数定义的列数来设置缩进的宽度,如果indent_style为tab,则此属性默认为  tab_width
tab_width       用一个整数来设置tab缩进的列数。默认是indent_size
end_of_line     设置换行符,值为lf、cr和crlf
charset         设置编码,值为latin1、utf-8、utf-8-bom、utf-16be和utf-16le,不建议使用utf-8-bom
trim_trailing_whitespace  设为true表示会去除换行行首的任意空白字符。
insert_final_newline      设为true表示使文件以一个空白行结尾
root           表示是最顶层的配置文件,发现设为true时,才会停止查找.editorconfig文件  

root = true

# 对所有文件生效
[*]
# utf-8编码
charset = utf-8
# 空格形式缩进2空格
indent_style = space
indent_size = 2
# 使用单引号
quote_type = single
# Linux换行符
end_of_line = lf
# 结尾插入新行
insert_final_newline = true
# 去除结尾空格
trim_trailing_whitespace = true

# 对后缀名为 md 的文件生效
[*.md]
trim_trailing_whitespace = false