aototo/blog

aotm 不同代码风格的缩进问题...

aototo opened this issue · 0 comments

使用 Editorconfig 来解决不同人的缩进风格

atom 编辑器
https://github.com/sindresorhus/atom-editorconfig

需要在项目根目录创建一个.editorconfig文件

下面是一个简单的demo.(ps: 这玩意要重启一下,很玄乎)

root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8

[*/*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8

[*.{json,yml}]
indent_size = 4

[*.md]
trim_trailing_whitespace = false

修改 indent_size 数值可以修改缩进的大小。

ps: atom的缩进设置在 * setting -> setting -> Editor Settings * 里面, atom-editorconfig 插件里也需要修改Tab Length