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.
The effect was that H which is ASCII 0x48 would become 0x08 which is backspace. If you look at an ASCII table (e.g. http://www.asciitable.com/) 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.
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.
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.
One other interesting thing about ASCII: uppercasing and downcasing can be done by twiddling a single bit.
This is correct, and the reason they used those keys was that it was the 'home row' on a typewriter which was used in teletypes which meant your little finger could push 'ctrl' and your right hand could drive the cursor through forms without moving off the home row.
When I saw the title I was expecting to see a picture of the rogue screen. Rogue (and later hack, and nethack) is a text displayed dungeon exploration game and was often the first exposure folks got to the convention of h,j,k,l as left right up down.
I really miss having control over there. I xkeymap it there of course but some keyboards have a physically 'push-on/push-off' caps lock key there which is annoying.
Count me in the school of thought that the control key is meant to be to the left of the A key, just like the horn button is meant to be in the center of a car steering wheel. Every computer keyboard I worked with before the advent of IBM PCs had this arrangement. Every computer I work with now I reconfigure to swap the caps lock with the control key.
It's a major frustration for me, too, as an Emacs user.
I'm still looking for a hardware dongle that does nothing but map the caps lock scan code to left ctrl. Sure, I can rebind the key (and I do) but as a contractor I move around a lot and having something that circumvents the OS entirely would come in handy.
I use a keyboard that has a similar layout to that in the images above (ctrl to left of A, tilde on home key at top right etc). It's called the Happy Hacking Keyboard and is made in Japan by a Fujitsu subsidiary: see here http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard. It's extremely expensive (~$300 or so) but has amazing key action and having gotten used to it I would never want to use anything else
Actually, on a Teletype, VT went down, not up. (Vertical tab stops were settable only in hardware on most models.) And FF, which went to the top of the next page, is obviously unrelated to going right. So the correspondence was really just suggested by BS and LF; it was apparently some terminal manufacturer's idea to put up and right on the next two keys.
As far as I know, this was Lear Siegler's invention; I don't know of any other terminals from the era that use ^K and ^L for "move up" and "move right". (Someone did mention that ^K and ^L did do that on the ADM-3A, right?)
Then the question becomes, is there a reason those control characters correspond to those letters? I have a hard time imagining a world where BS is ^Q and VT is ^V and therefore the arrow keys are spread out all over the keyboard.
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...
Bill Joy didn't invent modes; all editors were very modeful until Bravo, in the 1970s. And in vi, you don't use ^H to move left; you use h. Tony has already corrected you on ^K and ^L, but I'll point out that there was a way to move the carriage right on a Teletype, even though it wasn't ^L: the SPACE character does that.
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.
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.
I have another good suggestion: learn pressing the left control with the side of your palm. It's usually a very minimal movement, and I find it a lot easier (and less straining) than moving the pinky to press control. The only drawback is that it doesn't really work on a laptop keyboard.
I picked that up a few years back playing World of Warcraft and some other games, to avoid having to move my left hand away from WASD as much as possible, but it has served me very well in a lot of other applications since then.
Edit: Well, that was supposed to be an answer to cheatercheater below this comment. Woops.
Unless you use Dvorak. I know I'm in a super minority here. But shortcuts based on keyboard location rather than tied to some mnemonic are damn near impossible to get right. Doubly so when I have to switch to QWERTY to work with anyone else.
I switched cold turkey to Dvorak and Vim at practically the same time (what can I say, I like pain :) I learned Vim mnemonically and have no problem using Vim on QWERTY. At the same time, I could have just as easily learned it "locationally" and been screwed. Only chiming in because I think it's interesting that the learning curves for location-vs-mnemonic seem approximately equal, but the long-term payoff of one is much greater. Neat asymmetry.
I have created an ergonomic layout based on the us layout, called us_split. In it, Vim's hjkl actually are the home position. The layout works under Gnome. It's just like qwerty but a bit different. Basically the two columns from the right are put in the middle. Time to learn to use it fluently is only a couple of days if you touch type qwerty already.
I see a lot of people in the comments talk about vim's "weird" layout choices. I suggest in your OS you change caps lock to esc; and that in vim you remap ; to : and : to ; in order to stop having to press shift every time. You can then really start doing the whole home row thing; IMO it's impossible without those two crucial settings.
Another excellent trick I read somewhere is to map 'jj' or 'jk' to esc when in insert mode (so 'inoremap jj <ESC>'). As a digraph they never occur in a natural language, so you'll never type it accidentally. And you can hit it on the home row easy-peasy.
Although personally I type in Colemak, I still use this, just with 'yy' instead. To be honest, it's a barely noticeable slow-down but it's much less stressful for my hands.
It's common to use double letters (ii, jj, kk) as inner indices when writing tiled multi-dimensional array code. Regardless of whether you think that is a good convention, you should be preserving that convention if you are editing legacy code that was written that way.
They're not exactly the same thing, actually, ctrl-c doesn't allow you to expand abbreviations and doesn't trigger the InsertLeave autocommand, but to be honest, I don't think it's that big of a deal. I go between ctrl-c and ctrl-] without thinking.
That's a brilliant layout. Unfortunately it appears to require a "tall enter" keyboard rather than the much more common "wide enter". I'm in the market for a nice cherry blue keyboard, so I'll see if I can find one with a tall enter. Anybody have any sources?
I'm using the silent ([EDIT: I had this in reverse..] cherry mx brown; non silent is cherry mx blue) DAS keyboard. The "professional" model has the letters on the keys, if you don't want a blank one. They seem to come in both US (wide enter) and UK (tall enter) versions. I personally chose the UK one as that's what I'm used to.
Here is a photo of my keyboard. The coloured keys are sold as WASD/escape keys but I used them for playing Skyrim - the green one on the right is especially handy for gaming as i don't have my fingers on the home row when playing games rather than typing. The blurred circuit board is a development version of the Midifighter 3D as the photo was taken before they were announced.
I also have a Das keyboard and it is really awesome. (Also, I think it's the best looking keyboard I have ever seen--very minimalist.) However, I think you have them backwards--the "silent" version has the brown switches and the normal version has the blue switches. I also have the ultimate silent version and it is not really silent--it's just quieter than the other version. You still get a satisfying noise when you use it.
I've been really satisfied with it, and would definitely recommend it to anybody looking for a nice mechanical keyboard.
You are of course right! I have a brown, not a blue! Not sure why I was thinking about it in reverse - oops.
Well, mine is quieter than other keyboards I've used, eg a Dell keyboard as long as you don't bottom the keys out, though I do get the occasional loudish click when the keys snap back, usually from the space bar, though if I slow down when typing I can make it almost completely silent (obviously thats not normal typing though).
 I did have a Saitek eclipse a few years ago that was quieter.
It did cost a lot, but honestly, as a programmer I type so much, its totally worth investing in a good keyboard and I love my DAS keyboard.
The only thing I wish is that the keys were in a flat grid rather than staggered, but it seems very very hard to find any keyboard like that, so no biggy. I've considered getting a Kinesis for years now too, but since I got the DAS, I've had no plans of switching any time soon.
I haven't completely worked out my vim bindings since I've been doing a lot of Qt development in QtCreator lately and just used that without vi mode. I use Colemak for my layout so some of the default keys are a little less than optimal, but I also don't want to change them too much. With one or two simple key swaps it seems quite usable though.
On windows (where I don't use vim) I did map alt-gr to some common programmer symbols; mapped caps lock to control and control to backspace. On my laptop I use vanilla colemak though (including caps lock as backspace, though I'm likely going to change that some time).
I bought a das keyboard last year for home. I got the blank keyboard, but found that a lot of random hand issues went away. I ended up buying myself a second one for work, and will absolutely not go back to a standard keyboard.
It works for horizontal enter as well.. the only key that is missing from a horizontal-enter keyboard is the one between left shift and z, which is just backspace, so you can disregard it. It's just that with a horizontal enter key, the ; key is above the enter. With a boot-shaped enter key the ; is next to l, which makes it easier for me to hit it. I use the command line a lot.
If you're looking for a good place that does boot shaped enter keyboards then you can use Unicomp's Model M. You can rearrange the keys as you wish and they'll even print key caps with anything you want on them with the home row indicator tab, so you can put one on the h key.
The right shift key is covered only by the pinky finger of your right hand. The ring finger has the forward slash. If you give it a try make sure to send your comments over via bitbucket or something :)
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.
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
And the reason they didn't was that they evolved from typewriters that relied on a forward/backward spin to move up and down (except for the carriage return lever). We're lucky that the original terminals didn't have a scroll knob on the left and right of the machine to move up and down and a lever to move to the next line or we would have been stuck with that concept for years and the laptop may not have been invented because the knobs and lever would have required some elevation, which means the whole thing would have had to have been bigger.
I used a scroll knob to move up and down (and left and right) on my Blackberry in 2000, and it was awesome. It's dramatically better than using arrow keys. It's a real shame the original CRT terminals didn't have scroll knobs. It would have dramatically improved the usability of computers throughout the 1970s and 80s.
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.
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.
Honestly perhaps it's partly a defensive reaction about a tool I like. If so, my bad. Maybe I can't help but feel like the "article" could be perceived as saying "see, vim chose these keys simply because that's what the keyboard said without any thought toward efficiency". The idea that they're chosen for efficiency seems so self-evident that it doesn't need a flourish to reveal. It's likely I'm thinking too hard about it. In any case, it is a neat little bit of history and the link gets my upvote.
Maybe "efficiency" is implied, since folks using the initial version of vi would be used to using those keys for navigation anyway. So, I read this more as "Bill Joy used a convention" rather than "Bill Joy chose the most efficient keys for touch typists."
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.
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:
" 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
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.
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.
The ADM3A was a "dumb" terminal, constructed using a board full of 7400-series TTL ICs with no microcontroller. Probably to simplify the design, it wasn't capable of sending any multi-character escape sequences. (The ANSI escape sequences hadn't been standardized at that point yet either.)
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.
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.
This is good advice in all situations, having watched my bandwagon-jumping friends flail helplessly when using anyone else's computer. And all for a small potential increase in speed, at the cost of making your computer unusable to others and completely screwing the convenience of most keyboard shortcuts.
I love colemak. While I'm still not quite as fast as I once was with qwerty, it does seem to take less effort and my fingers seem to dance over the keys as most key combos do really seem to be placed side-by-side.
Tip from a dvorak vim user: instead of H/L for moving left/right, use H/SPACE. SPACE has almost the same function as L but is more convenient to hit with your thumb. SPACE also allows moving to the next line when the cursor it at the end of a line, unlike L.