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!

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).

Follow me!

If you enjoyed my post, subscribe to my blog, follow me on twitter, google+ or github. Thank you!

Comments

I used to see those terminals at public libraries. Only employees could use them; never the public.

tim Permalink
March 09, 2012, 16:15

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 :-)

March 09, 2012, 16:21

Ah! I just updated the article. Thought it was a computer.

October 30, 2014, 15:44

It's not pedantic. The sad thing is most people today will have no idea what you're talking about... "what's a terminal??"

March 09, 2012, 16:39

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.

Jerry Hubbard Permalink
March 27, 2012, 03:22

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.

Great discussion.

Altreus Permalink
March 09, 2012, 16:50

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!

Cliff Permalink
March 09, 2012, 17:24

Not all adm3a's were "terminals." My co-worker had one with a broken 'L' key. It was deemed a "terminak."

March 09, 2012, 17:49

> 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 :)

March 10, 2012, 12:32

I prefer Ctrl-[ because Ctrl-C has been already hardwired in my brain as a means to abruptly terminate a program.

Matthew Permalink
October 26, 2012, 14:00

Look at the fucking picture.

albanino Permalink
March 09, 2012, 17:54

nmap

<esc>

Q

March 09, 2012, 18:40

Huh, intriguing. And look at that up in the corner of the keyboard... HOME = ~

Now that makes sense, too. :)

Ollie Jones Permalink
March 09, 2012, 19:31

For three bonus points ... what does the HERE IS button do?

March 09, 2012, 19:42

Can't figure it out. Tell us! :)

Ollie Jones Permalink
March 09, 2012, 21:16

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.

Gunner Permalink
March 09, 2012, 21:23

Mr. Jones didn't reply so I looked it up:
http://en.wikipedia.org/wiki/Teleprinter#.22Here_is.22_key

Not as interesting as I had hoped... maybe someone can offer some context.

anon Permalink
March 09, 2012, 20:56

Perhaps it is to print the working directory; $ pwd.

Mikael Permalink
March 09, 2012, 21:16

It does make the cursor blink, maybe?

Ollie Jones Permalink
March 09, 2012, 19:29

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 Permalink
March 09, 2012, 19:40

IJKL makes so much more sense.
Apple //+ taught me that.

kris Permalink
March 09, 2012, 19:49

Yeah, and Bill Joy (wnj) was/is REALLY fast with vi. REALLY, REALLY fast. I worked with him at Sun a-way-back.

March 09, 2012, 21:25

And the 'control' key is where it should be, even before keyboard remapping.

March 10, 2012, 00:02

Very cool. I was truly always wondering why he went with hjkl instead of jkl;. Now I know.

Anonymous Permalink
March 10, 2012, 00:14

The HJKL keys for vi directions are also the same order as Dance Dance Revolution game, as it turns out.

Eric Dietiker Permalink
March 10, 2012, 15:25

Notice how easily reachable the CTRL key is. Life used to be a lot easier.

Zach Thomas Permalink
March 10, 2012, 16:37

Also notice the separate Carriage Return and Linefeed keys. Go UNIX!

March 10, 2012, 18:01

i use colemak layout and my current hjkl are remapped to h-up k-down j-left l-righ

March 12, 2012, 00:19

Nice to know about vi + hjkl.

March 13, 2012, 22:01

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).

March 19, 2012, 11:05

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 :)

April 08, 2012, 17:33

Wow, great post :))

I like emacs more :D

Glenn Hamblin Permalink
April 13, 2012, 17:37

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.

Martin Jansa Permalink
May 16, 2012, 10:31

I still have HP700-92 terminal at home (connected to my linux box) and it has ESC even better placed, next to left shift :).

http://en.wikipedia.org/wiki/File:Terminal-hp700-92.jpg

October 12, 2012, 04:50

Is there any chance of a third printing of the hjkl shirt? I missed both runs. :(

Janos Vasbanyai Permalink
January 22, 2013, 11:18

Up

trusktr Permalink
April 15, 2013, 21:33

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.

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "unix": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements