Skip to content

Commit 1317cac

Browse files
feat: Add .editorconfig (#16)
1 parent 7f9c1a9 commit 1317cac

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

.editorconfig

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# -----------------------------------------------------------------------------
2+
# mcpp-community EditorConfig
3+
#
4+
# This configuration is part of the mcpp-community style specification.
5+
# Repository:
6+
# https://github.com/mcpp-community/mcpp-style-ref
7+
#
8+
# EditorConfig ensures consistent editor behavior across different IDEs.
9+
# It complements .clang-format, which handles C/C++ code formatting.
10+
# -----------------------------------------------------------------------------
11+
12+
# -----------------------------------------------------------------------------
13+
# Root
14+
# -----------------------------------------------------------------------------
15+
root = true # Treat this directory as the root EditorConfig
16+
17+
# -----------------------------------------------------------------------------
18+
# Global defaults
19+
# -----------------------------------------------------------------------------
20+
[*]
21+
charset = utf-8 # Use UTF-8 encoding for all files
22+
end_of_line = lf # Use LF line endings
23+
insert_final_newline = true # Ensure files end with a newline
24+
trim_trailing_whitespace = true # Remove trailing whitespace on save
25+
26+
indent_style = space # Use spaces for indentation
27+
indent_size = 4 # Default indentation width
28+
29+
# -----------------------------------------------------------------------------
30+
# C / C++
31+
# -----------------------------------------------------------------------------
32+
[*.{c,cpp,cc,cxx,h,hpp,hxx}]
33+
indent_style = space # Use spaces for indentation
34+
indent_size = 4 # 4-space indentation for C/C++
35+
36+
# -----------------------------------------------------------------------------
37+
# CMake
38+
# -----------------------------------------------------------------------------
39+
[*.cmake]
40+
indent_style = space # Use spaces for indentation
41+
indent_size = 4 # Standard indentation for CMake scripts
42+
43+
[CMakeLists.txt]
44+
indent_style = space # Use spaces for indentation
45+
indent_size = 4 # Standard indentation for CMakeLists
46+
47+
# -----------------------------------------------------------------------------
48+
# Markdown
49+
# -----------------------------------------------------------------------------
50+
[*.md]
51+
trim_trailing_whitespace = false # Preserve trailing spaces (Markdown line break)
52+
53+
# -----------------------------------------------------------------------------
54+
# JSON / YAML
55+
# -----------------------------------------------------------------------------
56+
[*.{json,yml,yaml}]
57+
indent_style = space # Use spaces for indentation
58+
indent_size = 2 # 2-space indentation for structured data
59+
60+
# -----------------------------------------------------------------------------
61+
# Python
62+
# -----------------------------------------------------------------------------
63+
[*.py]
64+
indent_style = space # Use spaces for indentation
65+
indent_size = 4 # Python standard indentation
66+
67+
# -----------------------------------------------------------------------------
68+
# Makefile
69+
# -----------------------------------------------------------------------------
70+
[Makefile]
71+
indent_style = tab # Makefile requires tab indentation
72+
73+
# -----------------------------------------------------------------------------
74+
# Shell scripts
75+
# -----------------------------------------------------------------------------
76+
[*.{sh,bash,zsh}]
77+
indent_style = space # Use spaces for indentation
78+
indent_size = 4 # Consistent 4-space indentation for shell scripts
79+
80+
# -----------------------------------------------------------------------------
81+
# Docker
82+
# -----------------------------------------------------------------------------
83+
[{Dockerfile,docker-compose.yml}]
84+
indent_style = space # Use spaces for indentation
85+
indent_size = 4 # Standard 4-space indentation for Docker-related files
86+
87+
[*.dockerfile]
88+
indent_style = space # Use spaces for indentation
89+
indent_size = 4 # 4-space indentation for files named with .dockerfile extension
90+
91+
# -----------------------------------------------------------------------------
92+
# Git files
93+
# -----------------------------------------------------------------------------
94+
[{.gitattributes,.gitignore,.gitmodules}]
95+
indent_style = unset # Do not enforce indent style (these files are not code)
96+
indent_size = unset # Do not enforce indent size
97+
trim_trailing_whitespace = unset # Do not automatically trim trailing whitespace

0 commit comments

Comments
 (0)