Why use the keys hjkl on the same line instead of keys in a triangle like wasd for moving on video games?
Why not something equivalent with right hand, like ijkl or pl;'?
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!
Nobe4's answer is great, and explains why we use
hjkl very well. However, it's really interesting to see the full keyboard, and a lot of strange things about vim make more sense when you can see the full keyboard it was designed on. For example, why does vi rely so heavily on the
esc key, when it's in such a weird and uncomfortable place? This is why:
As you can see,
esc is where tab is on most keyboards.
ctrl is another key that is slightly awkward to reach, but in a very comfortable location on this keyboard (where caps lock usually is).
As to why these arrows were printed on these keys... it's because they could be used with the control key for local cursor movement. Ctrl-H and Ctrl-J (backspace and line feed) are obvious, and an easy mnemonic even today. Ctrl-K is "vertical tab", but was sometimes used for reverse linefeed on pre-ANSI terminals. The use of Ctrl-L for a non-destructive cursor forward was probably chosen based on its keyboard location.
You may also have noticed in the picture of the keyboard in the other answer that "HOME" is on the
~ key. Of course, Ctrl-^ homes the cursor (sends to the top left of the screen, or bottom left, depending on mode).
These control mappings were also used for Wyse terminals, the Kermit protocol, and were supported in some versions of PC ANSI.SYS.
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?