1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
{
config,
lib,
...
}:
with lib; let
cfg = config.nixfiles.modules.editorconfig;
in {
options.nixfiles.modules.editorconfig.enable = mkEnableOption "Editorconfig";
config = mkIf cfg.enable {
hm.editorconfig = {
enable = true;
settings = {
"*" = {
charset = "utf-8";
end_of_line = "lf";
indent_size = 2;
indent_style = "space";
insert_final_newline = true;
max_line_length = 80;
trim_trailing_whitespace = true;
};
# https://google.github.io/styleguide/cppguide.html#Spaces_vs._Tabs
"*.{c,cc,cpp,cxx,h,hh,hpp,hxx}" = {
indent_size = 2;
indent_style = "space";
};
# https://go.dev/doc/effective_go#formatting
"{*.go,go.mod}" = {
indent_size = 2;
indent_style = "tab";
};
# https://google.github.io/styleguide/pyguide.html#s3.4-indentation
# https://peps.python.org/pep-0008/#indentation
"*.py" = {
indent_size = 4;
indent_style = "space";
};
# https://google.github.io/styleguide/shellguide.html#s5-formatting
"*.{sh,bash}" = {
indent_size = 2;
indent_style = "space";
};
# https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17800010.3
# https://en.wikibooks.org/wiki/Haskell/Indentation
"*.hs" = {
indent_size = 2;
indent_style = "space";
};
# https://google.github.io/styleguide/lispguide.xml#Formatting
"*.{lisp,cl,rkt,scm,el}" = {
indent_size = 2;
indent_style = "space";
};
# https://github.com/ziglang/zig/wiki/FAQ#why-does-zig-fmt-use-spaces-instead-of-tabs
"*.zig" = {
indent_size = 4;
indent_style = "space";
};
"*.{asm,s,S}" = {
indent_size = 4;
indent_style = "spaces";
};
# https://www.gnu.org/software/make/manual/html_node/Rule-Syntax.html
"{Makefile*,*.mk}" = {
indent_size = 4;
indent_style = "tab";
};
# https://cmake-format.readthedocs.io/en/latest/configopts.html#tab-size
# https://cmake-format.readthedocs.io/en/latest/configopts.html#use-tabchars
"{CMakeLists.txt,*.cmake}" = {
indent_size = 2;
indent_style = "space";
};
# https://github.com/NixOS/rfcs/pull/166
"*.nix" = {
indent_size = 2;
indent_style = "space";
};
# https://nickel-lang.org/user-manual/syntax
"*.ncl" = {
indent_size = 2;
indent_style = "space";
};
# https://developer.hashicorp.com/terraform/language/syntax/style
"*.{tf,hcl}" = {
indent_size = 2;
indent_style = "space";
};
"*.{json,jsn}" = {
indent_size = 2;
indent_style = "space";
};
# https://yaml.org/spec/1.2.2/#61-indentation-spaces
"*.{yaml,yml}" = {
indent_size = 2;
indent_style = "space";
};
"*.{toml,tml}" = {
indent_size = 2;
indent_style = "space";
};
# https://google.github.io/styleguide/htmlcssguide.html#Indentation
"*.{html,css}" = {
indent_size = 2;
indent_style = "space";
};
# https://latexindentpl.readthedocs.io/en/latest/sec-default-user-local.html
"*.{tex,cls}" = {
indent_size = 4;
indent_style = "tab";
};
};
};
};
}
|