For some developers, two-space indentation is genuinely difficult to read comfortably over long periods of time. In my case, it causes real eye strain when trying to visually align nested blocks and follow code structure.
As we get older, our eyesight naturally becomes less sharp. Wider indentation improves readability, reduces visual fatigue, and makes deeply nested code easier to scan.
Four spaces is also a widely established convention across many languages and tools, which helps consistency for developers moving between ecosystems.
This is not about aesthetics or personal taste alone. For some of us, it is also about accessibility and long-term reading comfort.
I hope the community will seriously (re-)consider this direction.
PS. I know two-space indentation is used in some open-source Python projects from Google, and personally I really dislike it there as well.
I do use two spaces in Pascal, because Pascal code tends to be longer horizontally, and the explicit begin/end structure already provides strong readability cues. Nim relies much more heavily on indentation itself, which makes indentation width significantly more important for visual clarity.
fight people like me who will never use 4 spaces.
We will go back to this years later. Time will change your mind.
For some developers, two-space indentation is genuinely difficult to read comfortably over long periods of time.
Well for some developers code with four spaces is difficult to read 🤷
I mean there is no universal "right" answer, is there? You can't make everyone happy.
Two spaces is just a recommendation, feel free to format your code however you like. You can even format it locally with 4 and then format to 2 with a commit hook for compatibility with othe projects that use 2.
I mean there is no universal "right" answer, is there? You can't make everyone happy.
Of course there is. Use tabs for indentation and spaces for alignment.
Personally I prefer 2sp, but why not let the AI argue with itself for us: https://claude.ai/share/f016ed67-d952-42a1-92eb-3b3e9788a5f9
It raised a few interesting arguments I didn't even realize were a thing.
e.g. some could laugh at "Braille displays" issue, until we encounter some blind guy being Stephen Hawking of programming. also L. Torvalds's "Deliberate nesting deterrent" seems eye-opening and proven as a technically beneficial rule.
Another thing - Instead of debating 2sp vs 4sp it seems first we need to establish "Does the 2 vs 4/8 choice actually matter?" If it matters, e.g. Why not settle on 3 spaces as a compromise?
As a follow-up to @darkestpigeon - since an example might be helpful to the most who have never seen code like this - here is C-code (Nim forbids hard-tabs)https://github.com/c-blake/batch/blob/master/examples/ftw.c
Things like 80-column limits and side-comment beginning alignment can suffer some as is evident at the top of that file if you fiddle with the tabstop from 8 to 4 to 2. This is mostly just to say that "no convention along these lines is perfect" and Araq is right that people will just differ on trade-offs. That whole repo was an interesting code formatting experiment for me, though.
All of the above means extending indentation by default would be detrimental to most workflows.
[Colored] indent lines are a thing.
Yes they're great for Nim or even Agol/C style languages too. Some can also draw lines for indent blocks too. For example: https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow
I'm using neovim more now and haven't bothered looking for one yet.