Comment by rhinoceraptor
6 years ago
Bill Joy used an ADM 3A[1] terminal, and looking at the keyboard layout explains vi's key mappings almost entirely.
There are arrow keys printed on HJKL (accessed via control), escape is left of Q, control is left of A, and colon has a dedicated key rather than being shift+semicolon.
Another tidbit is that the home key is also used for tilde, which explains its association with the home directory.
1: https://en.wikipedia.org/wiki/ADM-3A#/media/File:KB_Terminal...
> and colon has a dedicated key
Well, it's :* and ;+ and so on, along with the now-unusual shifted number row: a bit-paired keyboard¹, matching ASCII, which was the practical thing to do when your terminal was hard-wired.
¹ https://en.wikipedia.org/wiki/Bit-paired_keyboard
This makes so much sense, and now looking at this image, I wonder if it explains "tabs vs spaces".
It does seem like an additional reason, but I'm convinced tabs were (are?) disliked primarily for historical and technological reasons. Historically the tab key worked with a tab stop; there's always friction when you switch paradigms. Technologically, accommodating a variable width non-printing character on an 80x25 character-mapped display for no particular reason must have seemed both gratuitous and wasteful when you consider the typical hardware of the time (monochrome terminals, CPUs on the order of 1-50 MHz, 1-5 MB RAM, < 1 MB ROM, etc).
> 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.
4 replies →