読者です 読者をやめる 読者になる 読者になる

てきとうなメモ

本の感想とか技術メモとか

viのコマンド

I was reading about vim the other day and found out why it used hjkl keys as arrow keys. When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys. Naturally he reused the same keys and the rest is history!

viでカーソル移動になぜhjklを使うのかというと、利用していたADM-3A端末のキーボードではhjklが矢印キーに該当していたからということみたい。

当然hjklとカーソル移動を区別する必要があるので、ADM-3AではCtrlキーを使っていたようだけども

Both the arrows and the "home" correspond to the functions of the corresponding control characters Ctrl-H, Ctrl-J, Ctrl-K, Ctrl-L, and Ctrl-^ (identical to Ctrl-~) when sent to the terminal, moving the cursor left, down, up, right, and to the "home" position in the upper left-hand corner of the terminal, respectively. [2] (The Ctrl-H and Ctrl-J functions were standard, but the interpretations of Ctrl-K, Ctrl-L, and Ctrl-^ were unique to the ADM-3A.)

ADM-3A - Wikipedia, the free encyclopedia

マニュアル(pdf)にも書いてある。

あと、なぜ簡単な1文字コマンドなのかというと利用していたモデムの速度が遅かったためらしい

Joy explained that the terse, single character commands and the ability to type ahead of the display were a result of the slow 300 baud modem he used when developing the software and that he wanted to be productive when the screen was painting slower than he could think.

vi - Wikipedia, the free encyclopedia

元記事にはこんな感じに書かれている

It was really hard to do because you've got to remember that I was trying to make it usable over a 300 baud modem. That's also the reason you have all these funny commands. It just barely worked to use a screen editor over a modem.

Bill Joy's greatest gift to man – the vi editor • The Register