| > disliked primarily for historical and technological reasons Huh? AFAIU, all the historical source code uses tabs for indentation. Both K&R and BSD style uses hard tabs, as does Linux kernel style and most older GNU project code for that matter. Various Unix programs assume tabs, for example indentation elision in shell heredoc syntax ("<<-") only works for tabs. Soft tabs (spaces) has been a relatively new thing in the C/Unix world. You may not notice it because, working as well as they do, hard tabs magically indent according to your local preference, so hard tabs aren't noticeable.[1] [1] What doesn't work is right-hand alignment. That's most noticeable in modern BSD code, where the style is to tab-align variable types and names into different columns. If your tab stop isn't set to 8 (the required tab stop), they don't line up. Most hard tabbers don't mix indentation and alignment, anymore. EDIT: Here's the earliest source code for vi I could quickly find: https://github.com/n-t-roff/ex-2.2/blob/220a2cfa/ex.c
It uses hard tabs. It's also still using pre-ANSI function syntax, suggesting this code wasn't cleaned up before committing to Git. |
I seem to have made assumptions due to only running into spaces in "old" places such as Python, Vim, Emacs, etc. To be fair, this all happened well before I was born. Why would software developers of all people try to do away with a useful abstraction?!
Oddly, the linked keyboard doesn't appear to have a tab key but the Vi source code you found contains them? Am I missing something obvious?
(`/* Copyright (c) 1979 Regents of the University of California */`, that's some impressively old code to find on GitHub.)
Re BSD: Yeah, tabs don't work for alignment almost by definition. I'm surprised anyone was crazy enough to author a code style that called for it.