Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Last active May 2, 2017 11:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/40a6949b9c14cb5e06080c91c8e9576d to your computer and use it in GitHub Desktop.
Save ryanlid/40a6949b9c14cb5e06080c91c8e9576d to your computer and use it in GitHub Desktop.
EditorConfig是一套用于统一代码格式的解决方案
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
@ryanlid
Copy link
Author

ryanlid commented Jul 22, 2016

EditorConfig是一套用于统一代码格式的解决方案

indent_style tab为hard-tabs,space为soft-tabs。

indent_size 设置整数表示规定每级缩进的列数和soft-tabs的宽度(空格数)。如果设定为tab,则会使用tab_width的值(如果已指定)。

end_of_line 定义换行符,支持lf、cr和crlf。

charset 编码格式,支持latin1、utf-8、utf-8-bom、utf-16be和utf-16le,不建议使用uft-8-bom。

trim_trailing_whitespace 设为true表示会除去换行行首的任意空白字符,false反之。

insert_final_newline 设为true表明使文件以一个空白行结尾,false反之。

root 表明是最顶层的配置文件,发现设为true时,才会停止查找.editorconfig文件。

官网
http://editorconfig.org/

中文参考
http://www.alloyteam.com/2014/12/editor-config/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment