cheatsheets/editorconfig.md

75 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2014-09-24 09:09:41 +00:00
---
title: editorconfig
2017-09-04 02:07:00 +00:00
prism_languages: [ini]
weight: -1
2020-07-04 13:33:09 +00:00
updated: 2019-09-25
2018-12-06 22:15:40 +00:00
category: Apps
2014-09-24 09:09:41 +00:00
---
2017-09-04 02:07:00 +00:00
### Short example
{: .-prime}
2014-09-24 09:09:41 +00:00
2017-09-04 02:07:00 +00:00
```ini
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
```
This example should be fine for most projects indented by 2 spaces. See: [animate.css editorconfig](https://github.com/daneden/animate.css/blob/master/.editorconfig)
### Properties
```ini
indent_style = {space|tab}
indent_size = {4|tab}
tab_width = 2
end_of_line = {cr|lf|crlf}
charset = {utf-8|utf-16be|utf-16le|latin1}
trim_trailing_whitespace = false
insert_final_newline = true
max_line_length = 80
```
### Full example
```ini
2014-09-24 09:09:41 +00:00
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# 4 space indentation
[*.py]
indent_style = space
indent_size = 4
# Tab indentation (no size specified)
[*.js]
indent_style = tab
# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
```
2014-10-23 11:38:50 +00:00
### References
2019-09-24 15:35:57 +00:00
- <https://EditorConfig.org>