News for hackers. Stuff that matters.
Re:Why the fuck are we templating YAML? (2019) by WorldMaker on Tuesday January 23, 2024 @12:44PM (#39106779)
The behavior described above seems to me to be exactly soft tabs at 4 in a 2-space tab document with autoindent turned on (often the default).

Vim has no autodetect by default. (I'm sure there's a plugin somewhere.)

Re:Why the fuck are we templating YAML? (2019) by Dylan16807 on Tuesday January 23, 2024 @01:09PM (#39107154)
The part where the user is on a line indented by 2, hits return, and gets a line indented by 2+4=6 doesn't sound like soft tabs at 4 to me. And I wouldn't expect hitting backspace to then only remove 1 space (if it actually removed 2 that makes more sense, but is inconsistent with what what it just added). At that point, hitting return and getting a line indented by 8 might make sense but is weird.

Another comment suggests it's using 2 and 4 for different settings and that's causing problems.

Re:Why the fuck are we templating YAML? (2019) by WorldMaker on Tuesday January 23, 2024 @03:42PM (#39109471)
2 is the base indent of the line where the : was added. Autoindent adds 4 spaces for the current tab stop. Autoindent isn't using some counts of indents, it's taking "spaces in previous line + tab stop".

Backspace doesn't unindent in vim by default, it removes spaces one at a time. That's a difference between the ts=4 (tab stop) and sts=4 (soft tab stop) is sts also applies to backspace. But the default is that it doesn't because the out of the box default believes that backspace operates on physical characters (spaces) not soft/fake ones (tabs expanded to spaces) by default.

I don't know if that is the right default, and it is definitely a baroque exercise to get all the settings right for some languages, but there is a consistency to the defaults even if those defaults don't meet some modern expectations from newer code editors.

(Also, I just realized above I confused tw [text width] and ts [tab stop]; my vim skills are rusting a little.)

Re:Why the fuck are we templating YAML? (2019) by Dylan16807 on Tuesday January 23, 2024 @04:17PM (#39109981)
That doesn't explain how it then goes to 8 total spaces.