[PATCH] Add .editorconfig file for basic formatting
From: Íñigo Huguet
Date: Tue Feb 21 2023 - 10:59:14 EST
EditorConfig is a specification to define the most basic code formatting
stuff, and it's supported by many editors and IDEs, either directly or
via plugins, including Vim and emacs.
It allows to define formatting style related to indentation, charset,
end of lines and trailing whitespaces. It also allows to apply different
formats for different files based on wildcards, so for example it is
possible to apply different configs to *.{c,h}, *.py and *.rs.
In linux project, defining a .editorconfig might help to those people
that work on different projects with different indentation styles, so
they cannot define a global style. Now they will directly see the
correct indentation on every fresh clone of the project.
See https://editorconfig.org
Signed-off-by: Íñigo Huguet <ihuguet@xxxxxxxxxx>
---
.editorconfig | 19 +++++++++++++++++++
.gitignore | 1 +
2 files changed, 20 insertions(+)
create mode 100644 .editorconfig
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000000..0791a12a20f0
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,19 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{c,h}]
+indent_style = tab
+indent_size = 8
+
+[{Makefile,Makefile.*,*.mk}]
+indent_style = tab
+indent_size = 8
+
+[*.{py,rs}]
+indent_style = space
+indent_size = 4
diff --git a/.gitignore b/.gitignore
index 20dce5c3b9e0..6d09f3003484 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,6 +102,7 @@ modules.order
!.gitignore
!.mailmap
!.rustfmt.toml
+!.editorconfig
#
# Generated include files
--
2.34.3