Here is why vim uses the hjkl keys as arrow keys
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!
Here is how the hjkl keys looked:
ADM-3A keyboard's hjkl keys with arrows.
And here is the whole terminal that vi was created on:
Lear Siegler's ADM-3A computer terminal.
Since vim is derived from vi, it uses the same hjkl keys.
And while we're at it, notice where the ESC key is positioned:
Lear Siegler's ADM-3A computer terminal's full keyboard.
That's why the ESC is used to change between vi modes! Because it's so close and easy to reach.
Also ever wondered why home directory is
in UNIX? Look at the HOME key in upper right corner!
HJKL T-Shirt!
Update: No longer available.
I just got a deal with Teespring for a hjkl t-shirt! Teespring is like kickstarter for t-shirts. If at least 15 people commit to buy the shirt the deal goes through and everyone gets the shirt. Otherwise nothing happens.
Get your limited edition hjkl t-shirt now! (Ships worldwide in 4-8 days.)
Extra Discussions!
My post has generated a lot of awesome responses, see hacker news, osnews, and reddit discussions (two of them on /r/programming and /r/vim).
If you enjoyed my post, subscribe to my blog, follow me on twitter, google+ or github. Thank you!
Related Posts
I used to see those terminals at public libraries. Only employees could use them; never the public.
Sorry to be pedantic, but the ADM-3A is a terminal. The computer is probably that huge cabinet behind it which takes up most of the room :-)
Ah! I just updated the article. Thought it was a computer.
Ah,kids these days don't know what they missed.
It's not pedantic. The sad thing is most people today will have no idea what you're talking about. "what's a terminal??"
I spent many many hours on ADM-3As, when I could get on one, back in the early 80s. Most of the terminals in the University of New Mexico computer center were DECWriters, which were basically printers with keyboards. If you could get on an ADM, that was lux. Plus, some of ADMs had 1200 baud Gandalf modems, too, which were much faster than the 300 baud ones on most terminals.
Plus, if you were on a tube, you could play snake.
Andy you are getting old. I looked into University of New Mexico in the mid 70s. With a wife and daughter, plus bills, the Army's (Radar) training landed good tech jobs over the years. Wish I had the resources to get an EE back then. It would have been more fun.
Here I was expecting technical details about sending encoded arrow keys down the wire, and why hjkl are unambiguous while ↑↓←→ suffer issues over slow connections!
Not all adm3a's were "terminals." My co-worker had one with a broken 'L' key. It was deemed a "terminak."
> That's why the ESC is used to change between vi modes! Because it's so close and easy to reach
Assuming you're joking. FWIW can change modes with Ctrl - C which is more ergonomic :)
I prefer Ctrl-[ because Ctrl-C has been already hardwired in my brain as a means to abruptly terminate a program.
Look at the fucking picture.
Huh, intriguing. And look at that up in the corner of the keyboard. HOME =
Now that makes sense, too. :)
For three bonus points . what does the HERE IS button do?
Can't figure it out. Tell us! :)
I guess the teletype interface is truly in the dustbin of history (where it belongs, no doubt).
Pressing HERE IS causes a teletype device (the ADM3A is one) to send its station identification, if equipped with an answerback option. The reception of an ENQ (CTRL-E) character from the far end also causes the device to transmit its identification.
I never saw an ADM3A that actually had an answerback option. The Lear-Seigler folks must have imagined they were going to sell this baby as a glass telex. Then Bill Joy developed vi, and business took off.
http://www.classiccmp.org/dunfield/altair/d/adm3a.pdf page 3-8.
Mr. Jones didn't reply so I looked it up:
Not as interesting as I had hoped. maybe someone can offer some context.
Perhaps it is to print the working directory; $ pwd.
It does make the cursor blink, maybe?
Whoa. Blast from past. I remember upgrading a bunch of these little blue thingies so they could display lower-case letters.
They were really robust. Yay curses(3).
I am getting old.
IJKL makes so much more sense.
Apple //+ taught me that.
Yeah, and Bill Joy (wnj) was/is REALLY fast with vi. REALLY, REALLY fast. I worked with him at Sun a-way-back.
And the 'control' key is where it should be, even before keyboard remapping.
Very cool. I was truly always wondering why he went with hjkl instead of jkl;. Now I know.
The HJKL keys for vi directions are also the same order as Dance Dance Revolution game, as it turns out.
Notice how easily reachable the CTRL key is. Life used to be a lot easier.
Also notice the separate Carriage Return and Linefeed keys. Go UNIX!
i use colemak layout and my current hjkl are remapped to h-up k-down j-left l-righ
Nice to know about vi + hjkl.
The reason the left arrow shared the H key is because Ctrl-H is backspace. The down arrow shared the J key because Ctrl-J is newline. It makes sense to reverse make a mirror image (reverse) of these for K and L, so everything is together. Also, mnemonically speaking, Ctrl-K is Vertical Tab (think vertical tab in reverse, up arrow), and Ctrl-L is Form Feed (think next, right arrow).
Cool! BTW, hjkl-keys did a favour for me many times when arrow keys was not working on Dell's iDRAC java-interfaces. God bless Bill Joy :)
I like emacs more :D
I still have one of these babies (ADM-3A) tucked away in storage somewhere. I used it for testing emulation software I wrote to replace it. :-)
I remember using the HJKL cursor control.
I still have HP700-92 terminal at home (connected to my linux box) and it has ESC even better placed, next to left shift :).
Is there any chance of a third printing of the hjkl shirt? I missed both runs. :(
But why did Lear Siegler just make uhjk for movement instead of hjkl. WTF?? It makes no sense. uhjk is shaped in such a way that up and down are really up and down from each other. It makes more sense spatially to have uhjk than hjkl. I wish vim would add an official uhjk mode where the undo key is moved to l.
Because HJKL is on the home row of keys.
I too spent hundreds of hours (if not more. ) in front of ADM-3As. They were one of my favorite terminals, second only to the Televideo 950.
more like why vi uses hjkl, vim uses them because its a (big, ugly, slow, bloated) copy
Leave a new comment
Advertisements
Peter Krumins' blog about programming, hacking, software reuse, software ideas, computer security, browserling, google and technology.
Subscribe through an RSS feed:
Subscribe through email:
I love to read science books. They make my day and I get ideas for awesome blog posts, such as Busy Beaver, On Functors, Recursive Regular Expressions and many others.
Take a look at my Amazon wish list, if you're curious about what I have planned reading next, and want to surprise me. :)
Комментариев нет: