IDEA .editorconfig 代码风格设置
IDEA About 1,150 words默认支持的编辑器
IDEAVisual StudioGithub、Gitlab
需安装插件的编辑器
VS CodeEclipseSublime Text
配置案例
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true
[*.md]
max_line_length = 0
trim_trailing_whitespace = false
配置语法
root = true
EditorConfig插件会在文件夹中查找.editorconfig文件,解析文件内容,找到root = true的.editorconfig文件就会停止查找。
注释
使用#或;表示注释
指定配置适用文件类型
使用[*]表示:适用所有文件。
使用[*.md]表示:适用md结尾的文件。
使用[*.{js,ts,vue}]表示:适用js、ts、vue结尾的文件。
常用配置
indent_style:缩进样式。tabspace
indent_size:缩进长度- 正整数,比如:
2 tab
- 正整数,比如:
tab_width:tab键长度- 正整数
end_of_line:行结束标识符lf:Unix和macOS(\n)crlf:Windows(\r\n)cr:Classic Mac OS(\r)
charset:字符集utf-8latin1
trim_trailing_whitespace:删除行尾空白字符truefalse
insert_final_newline:文件末尾新起一行truefalse
max_line_length:行最大长度- 正整数
off
参考
https://github.com/editorconfig/editorconfig
https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
Views: 2,018 · Posted: 2023-10-18
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...