EditorConfig

EditorConfig:

  1. EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.

简单的说,就是一个代码缩减格式化辅助工具,需要编辑器或者IDE插件支持。

配置示例

  1. # EditorConfig helps developers define and maintain consistent
  2. # coding styles between different editors and IDEs
  3. # editorconfig.org
  4. root = true
  5. [*]
  6. # change these settings to your own preference
  7. indent_style = space
  8. indent_size = 4
  9. # we recommend you to keep these unchanged
  10. end_of_line = lf
  11. charset = utf-8
  12. trim_trailing_whitespace = true
  13. insert_final_newline = true
  14. [*.md]
  15. trim_trailing_whitespace = false
  16. [{package,bower}.json]
  17. indent_style = space
  18. indent_size = 4

参考资料