OSDN Git Service

Regular updates
[twpd/master.git] / editorconfig.md
1 ---
2 title: editorconfig
3 layout: 2017/sheet
4 prism_languages: [ini]
5 weight: -1
6 updated: 2019-09-25
7 category: Apps
8 ---
9
10 ### Short example
11 {: .-prime}
12
13 ```ini
14 # editorconfig.org
15 root = true
16
17 [*]
18 indent_style = space
19 indent_size = 2
20 tab_width = 2
21 end_of_line = lf
22 charset = utf-8
23 trim_trailing_whitespace = true
24 insert_final_newline = true
25 ```
26
27 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)
28
29 ### Properties
30
31 ```ini
32 indent_style = {space|tab}
33 indent_size = {4|tab}
34 tab_width = 2
35 end_of_line = {cr|lf|crlf}
36 charset = {utf-8|utf-16be|utf-16le|latin1}
37 trim_trailing_whitespace = false
38 insert_final_newline = true
39 max_line_length = 80
40 ```
41
42 ### Full example
43
44 ```ini
45 # top-most EditorConfig file
46 root = true
47
48 # Unix-style newlines with a newline ending every file
49 [*]
50 end_of_line = lf
51 insert_final_newline = true
52
53 # 4 space indentation
54 [*.py]
55 indent_style = space
56 indent_size = 4
57
58 # Tab indentation (no size specified)
59 [*.js]
60 indent_style = tab
61
62 # Indentation override for all JS under lib directory
63 [lib/**.js]
64 indent_style = space
65 indent_size = 2
66
67 # Matches the exact files either package.json or .travis.yml
68 [{package.json,.travis.yml}]
69 indent_style = space
70 indent_size = 2
71 ```
72
73 ### References
74
75 - <https://EditorConfig.org>