Open Spiffyk opened 2 weeks ago
I am unsure if such a weird of way formatting the indent widths would actually work but if you like to disable, there is one PR here https://github.com/helix-editor/helix/pull/11920.
I think improving the heuristics like copying the algo from the NMAC427/guess-indent.nvim is much better but for your usecase, it doesn't seem like it would work.
@daedroza To be clear, this issue is not so much about auto-detecting the indentation style.
Instead, it is about what happens when I create a new line. The indent-heuristic = simple
is almost what I want - keeping the indent of the previous line - but instead of it trying to figure out the width, then padding that with its own mix of tabs and spaces, I want it to be basically even dumber and just copy verbatim whatever leading whitespace was on the previous line.
And as for the indent
option in language.toml
(or the auto-detected indent), I want that to only apply to me pressing Tab
, <
, or >
.
There is a little gripe I have with
indent-heuristic = simple
while using the "tabs to indent, spaces to align" styling. For C functions, when parameters are long, I tend to do it like this:With
indent = { tab-width = 8, unit = "\t" }
, when I add a new line to the parameters, Helix matches the previous indent by putting as many tabs as can fit, then padding the rest with spaces, like so (with.
being spaces,<------>
being tabs):It would be nice to have an
indent-heuristic
that simply copies the same exact whitespace onto the new line instead - where there are all tabs, copy tabs; where there are all spaces, copy spaces; if there is some weird mixture, just copy the mixture - i.e. to be even less clever about it.If there is interest, I am willing to author a PR for this, be it by adding a new special heuristic, or changing the existing
simple
one.