Doesn't this go way back though?<p>The reason that keyboard had those arrows keys on it was because those keys correspond to CTRL-H, J, K, L and the CTRL key back then worked by killing bit 6 (and bit 5) of the characters being typed.<p>The effect was that H which is ASCII 0x48 would become 0x08 which is backspace. If you look at an ASCII table (e.g. <a href="http://www.asciitable.com/" rel="nofollow">http://www.asciitable.com/</a>) you will notice how the uppercase ASCII letters line up nicely with the control characters so that just dropping bit 6 will get you there. Same thing with the lowercase (drop bits 5 and 6) and you are on the control characters.<p>The CTRL-H, J, K, L therefore correspond to BS, LF, VT, FF. BS is backspace (i.e. left), LF (down), VT is vertical tab (so up) and FF is form feed (which in this case takes you up). I'm not sure why FF was used for up.<p>This is also why CTRL-I is tab, CTRL-D ends a communication. All of that goes back to teletype days. Also for telnet users out there you'll see that CTRL-[ lines up nicely with ESC. And when you see a ^@ being printed on the terminal you can see why it corresponds to a null byte.<p>One other interesting thing about ASCII: uppercasing and downcasing can be done by twiddling a single bit.<p>If you look at this picture of an ASR-33 Teletype you'll see that come of the control characters on the keyboard correspond to those in the ASCII set. This is because ASCII evolved from the earlier teletype character sets: <a href="http://upload.wikimedia.org/wikipedia/commons/0/0b/ASR-33_2.jpg" rel="nofollow">http://upload.wikimedia.org/wikipedia/commons/0/0b/ASR-33_2....</a>
ADM3a was a terminal, not a computer. I used to use these two in around 1976 or so. And the hjkl pattern has nothing to do with this or any other terminal. The ASCII control codes for Ctrl-H, Ctrl-J, Ctrl-K and Ctrl-L were used to make the Teletype's printing carriage move left, down, up or right. Bill Joy's innovation was "modes" so that Ctrl-H did not delete the character when it moved left, etc...
Most of the answers I've seen as to why hjkl have fallen into the "so your fingers stay on the home row / it's actually quite fast once you get used to it" realm. But those answers were never completely satisfactory to me. Once you get used to it, it's fine. But I feel like it would have been fine as adsw, or jkl; (so that your hand really is on the home keys) or some other 4 key combination near the home row, too.<p>This explanation of the origin hjkl is the first one to satisfy me. Now I can see the others, not as explanations as to why it is, but explanations as to why it stuck.
Oh lord! I remember these unibody terminals. I had to use the Volker-Craig VC4404 . That thing was built like a tank. You had to hammer at the keys with great force. Soon one got into the habit of hammering on the keys all the time.<p>And then one day I walked into the lab with shiny new VT-100 terminals with their soft keys; but started hammering on them by habit. And everybody turned around and looked at me as if I was possessed..... :-D
Perhaps just as enlightening is the location of the Esc key (to the left of Q):
<a href="http://en.wikipedia.org/wiki/File:KB_Terminal_ADM3A.svg" rel="nofollow">http://en.wikipedia.org/wiki/File:KB_Terminal_ADM3A.svg</a>
I worry that the tone of the article seems dismissive of the choice that went into mapping those keys to arrow directions in vi ("That's the whole story"). As if to say it was mere happenstance that vi uses hjkl, and any other outcome was equally likely.<p>It seems more the case that the designers of that computer chose those particular keys on the basis of a desire for efficiency that vi also followed, so there was no need to create a new convention.
I've got one of those sitting in my spare room... I'd be using it right now were it not for a busted flyback, which emits a whine capable of giving me a headache within 15 minutes. It's really a rather nice terminal, with an oddly attractive screen font and a keyboard that is well-suited to UNIX.<p>The coolest part is that there is no microprocessor, just a bunch of 7400 series ICs and some DIP switches to configure things.
If anyone is apprehensive about vim's hjkl keys, and you like the arrow keys better, you can use ijkl instead and get all the benefits of the muscle memory you have built up for arrow keys, while still keeping your hands on the home row. Use this mapping:<p><pre><code> " remap h to i and use ijkl for inverse T cursor movement
map k g<Down>
map i g<Up>
map j <Left>
noremap h i
</code></pre>
Then the 'i' key will be replaced by 'h'. So press 'h' to insert, or for inner selections, instead of 'i'. Also note the 'g' for up/down motions, which means it won't skip the wrapped part of lines - just remove the 'g' if you don't like that.<p>If you're worried this breaks anything else, I've had this interfere with just one other thing: a plugin that let me select text based on indentation of the line the cursor was on, but I made a few minor changes to the vimfile for the plugin and fixed that pretty easily. The other thing is that random servers won't have these mapped, but just copy the config over if you'll be doing a lot of text editing on that server. Otherwise, you can just fall back to using hjkl awkwardly.
Another reason to use HJKL is that over a 1200bauds line, it is faster to send a single byte than the 3 bytes generated by the arrow keys (^[[D^[[A^[[B^[[C)
The ADM-3A was a dumb terminal (well, it had to have had some level of screen addressibility, but was definitely not ANSI-compatible), not a computer. They were sold as kits, and about 1/3 the price of a VT-100. I remember reading somewhere that they were the first glass teletypes available to the BSD folks, and Bill Joy wrote vi purely because it allowed him to monopolize one for his own use.
You will find similar reasons for why Emacs chose many of its common keys if you examine the [Space Cadet keyboard](<a href="http://en.wikipedia.org/wiki/Space-cadet_keyboard" rel="nofollow">http://en.wikipedia.org/wiki/Space-cadet_keyboard</a>) for which it was designed.<p>All those awkward Control reaches originally laid comfortably under the thumbs.
This feature of vi/vim along with not being able to save and quit as quickly as I can in emacs (ctrl-s ctrl-x, baby, none of that :q! shite) is the reason I use emacs. I totally respect those that use vim, but I'm not a freaking machine.