There is a place for history in everything familiar

Last month I researched two historical questions. I originally posted the results as threads on Twitter, but now I am duplicating them as an article.





Why vim uses hjkl

Question : Why does vim use hjkl and not arrows for navigation?





Typical explanation : To keep the fingers from leaving the home row.





Historical explanation : Bill Joy developed vi on the ADM-3A video terminal, which lacked individual arrow keys. If you look at the ADM keyboard, there are arrows on the hjkl keys. Joy used the same logic for vi, and later for Vim.





ADM keyboard
ADM keyboard

Even more historical explanation : Actually, it's strange that on ADM hjkl was used for arrows. Why exactly these letters?





There is a great reason for this. Look at the 1967 version of the ASCII character table:





7 . 32 — " ", , -. , QWERTY-, , . "" , . . , "backspace", ctrl+H ( ^H). 100 1000 000 1000. , , ^J.





ADM, , "backspace" ADM " " . ^H ^J "" "", ^K ^L "" "". ADM hjkl , vi.





JavaScript

: JavaScript' date API 0-11, 1-12. ?





: . , . , date.GetMonth() .





: Java, , , C.





: C ? , C, , ?





tm_date



ANSI C89, . C , Unix-. Unix, , <ctime.c>



C , .





#define SEC   0
#define MIN   1
#define HOUR  2
#define MDAY  3
#define MON   4
#define YEAR  5
#define WDAY  6
#define YDAY  7
#define ISDAY 8

      
      



ctime -- (SMH), HMS. , , . Unix 5 , :





int *t;
{
    register char *cp, *ncp;
    register int *tp;
  
    cp = cbuf;
    for (ncp = &quot;Day Mon 00 00:00:00 1900\\n&quot;; *cp++ = *ncp++;);
    ncp = &amp;&quot;SunMonTueWedThuFriSat&quot;[3*t[6]];
    cp = cbuf;
    *cp++ = *ncp++;
    *cp++ = *ncp++;
    *cp++ = *ncp++;
    cp++;
    tp = &amp;t[4];
    ncp = &amp;&quot;JanFebMarAprMayJunJulAugSepOctNovDec&quot;[(*tp)*3]; // (a)
    *cp++ = *ncp++;
    *cp++ = *ncp++;
    *cp++ = *ncp++;
    cp = numb(cp, *--tp); // (b)
    cp = numb(cp, *--tp+100); // (c)
    cp = numb(cp, *--tp+100);
    cp = numb(cp, *--tp+100);
    cp =+ 2;
    cp = numb(cp, t[YEAR]);
    return(cbuf);
}
      
      



. (a). , , , , . , (b) HMS (c), . SMH ( ). , , , .





, . , Unix PDP-7. 1970- . , , 10% RAM!





, CPU, — , , . , , (b), .





: MDAY ( ) , YDAY ( ) — . " ": . ( ).





. , "" . hjkl, , ASCII- . tm_date, Unix, , , . — . , .





. , . , - , , - . , , "", , . , , , " ". , , "" .





. , — . , , , , . , ADM-3A, . , .





. , , , . , , , , . .








All Articles