Add top-level .editorconfig file

Add a .editorconfig [1] file.  This helps configure editors
automatically with the right whitespace settings.  It will help me,
since I need to juggle with different whitespace settings for different
projects.   But I think it can also help newcomers get things right from
the start.

Some editors have native support for reading these files, while others
require a plug-in [2].  And if you don't want to use it, then this file
doesn't change anything to your life.

I added rules for the kinds of files I edit most often, but more can be
added later.  I assumed that the rules were the same for GDB and the
other projects, but if that's not the case, we can always put
.editorconfig files in project subdirectories to override settings.

[1] https://editorconfig.org/
[2] https://editorconfig.org/#download

Change-Id: Ifda136d13877fafcf0d137fec8501f6a34e1367b
This commit is contained in:
Simon Marchi 2022-01-27 15:15:08 -05:00
parent 2f49159cfb
commit 459140adc0

47
.editorconfig Normal file
View File

@ -0,0 +1,47 @@
# Copyright 2022 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file helps editors auto-configure whitespace settings.
#
# See here for more information about the format and editor support:
#
# https://editorconfig.org/
root = true
[*]
end_of_line = lf
insert_final_newline = true
tab_width = 8
# Makefile
[{Makefile*,*.mk}]
indent_style = tab
indent_size = 8
# C/C++
[*.{c,h,cc}]
indent_style = tab
indent_size = 2
# Expect / TCL
[*.{exp,tcl}]
indent_style = tab
indent_size = 4
# Python
[*.py]
indent_style = space
indent_size = 4