Skip to content

Commit

Permalink
Add an EditorConfig file
Browse files Browse the repository at this point in the history
This addition serves two purposes:

1. It helps to enforce consistent formatting in editors that support the
   EditorConfig format. This reduces the odds that a contributor submits
   a change that deviates from existing code-style.

2. It improves the display of tabs on GitHub.com, which is notorious for
   being hostile towards users who prefer tabs instead of spaces (a.k.a,
   the logical and superior method of indenting source code).

   As a kludge, GitHub's devs added an admittedly-buggy enhancement that
   scales the width of tab characters to the local `indent_size` setting
   configured in a repository's `.editorconfig` file.

   This approach is imperfect, and goes against the principles of proper
   tab-use; i.e., semantic indentation, described in the style-guides of
   Go, jQuery, WordPress and other projects that care about readability.
   Consult the URL below for a more in-depth discussion of this matter.

      http://github.com/isaacs/github/issues/170#issuecomment-590214226

   The `default_only` field is a non-standard property that, eventually,
   will enable authors to configure a GitHub project's default tab-width
   without forcing the setting upon those working with code locally. The
   EditorConfig spec permits extensions in the form of new properties so
   this isn't strictly illegal.

   The `elastic_tabstops` property is also non-standard, but the feature
   it references is well-specified and likely to be supported by certain
   EditorConfig implementations (though I currently know of none). Spec:
   https://nickgravgaard.com/elastic-tabstops/
  • Loading branch information
Alhadis committed Apr 9, 2021
1 parent 5b30ae9 commit c5ce3ca
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- indent-tabs-mode: t; tab-width: 25 -*- vim: ts=25 noet
root = true

[*]
trim_trailing_whitespace = true
insert_trailing_newline = true
default_only = indent_size tab_width
charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 8
tab_width = 8

[/.editorconfig]
default_only = unset
elastic_tabstops = true
indent_size = 25
tab_width = 25


# Ad hoc tweaks
[troff/troff.d/devaps/daps.g]
indent_size = 4
tab_width = 4

[eqn/eqnchar.d/greek]
indent_size = 10
tab_width = 10

[eqn/eqnchar.d/iso]
charset = latin1

[{CHANGES{,_GR},/LICENSE.d/*}]
indent_style = space
indent_size = unset


# Tabular data
[{*.tsv,**/devhtml/charset}]
elastic_tabstops = true
default_only = unset
tm_scope = source.generic-db
indent_size = 16
tab_width = 16


# PostScript is limited to 8-bit ASCII encoding
[{ps.requests,**/devpost/charlib/*}]
tm_scope = source.postscript
charset = latin1

[**/devpost/charlib/{*.map,BRACKETS_NOTE,README}]
charset = unset

0 comments on commit c5ce3ca

Please sign in to comment.