diff options
| author | 2026-02-06 11:24:22 +0100 | |
|---|---|---|
| committer | 2026-02-06 11:24:22 +0100 | |
| commit | d8f0f2082e8c02b67a5e7a896c670a11b4042659 (patch) | |
| tree | bda58de4cf54dc39445e321e7de43e13d24af174 /dot_editorconfig | |
| parent | zsh: remove / from WORDCHARS (diff) | |
editorconfig: default to indent_style=space
This is a funny one. In emacs' editorconfig.el, you can see the
following comment: "When users choose `indent_size=tab`, they most
likely prefer `indent_style=tab` as well.
Ths directly follows a workaround an issue of excessively setting
tab-width even when it's not explicitly requested.
This means that the behavior of editorconfig.el is as follows:
* If tab_width is set, the value is used.
* Else, if indent_style is set to "tab", indent_size is used for
tab_width.
What I would like is to keep my tab_width and (non-existent)
space_width in sync, and then have (by default) the default
per-filetype indentation style, with the ability to override
them.
This means unsetting indent_style (as it was before), and then setting
indent_size to the common width, which is the editorconfig preferred
approach. Because of the abovementioned bug workaround, since
indent_style is unset (i.e. is not "tab"), indent_size is not used for
tab_width.
Up until now, the way I've been working around this is by setting
indent_size to tab and then using tab_width to control the de-facto
indent_size (reversing the logic). This has the additional bonus of
being more explicit, and keeping mixed tab/space indentations
internally consistent. The problem then is that the indent_size=tab is
treated as a hint to set indent_style=tab globally, removing my
ability to use the filetype default.
I can either patch the code in question, or I can just accept that my
global preference (as a default, other things not considered) is for
spaces (though I do appreciate tabs in specific circumstances). This
line applies this : spaces are now a global default, and I can set a
tab style where appropriate, including in projects.
Diffstat (limited to 'dot_editorconfig')
| -rw-r--r-- | dot_editorconfig | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/dot_editorconfig b/dot_editorconfig index d45d72c..910689e 100644 --- a/dot_editorconfig +++ b/dot_editorconfig @@ -7,6 +7,7 @@ charset = utf-8 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +indent_style = space # whether tabs or spaces, default to 4 indent_size = tab tab_width = 4 |
