In vim, why is 'j' used for down and 'k' for up?

vimtutor provides the mnemonic that 'J' looks vaguely like a downward-pointing arrow, though that may or may not be the original reason why it was chosen.


This is a total guess, but: The Ctrl+J character is the "line feed" character, which on a traditional TTY moves down one line, providing a mnemonic. K was right next to it on a Qwerty keyboard, under the second most commonly used finger on the right hand when in the home position.


The answer is in the Wikipedia entry for vi. Bill Joy, who wrote the visual mode of ex - which ended up being Vim precursor vi - used a Lear Siegler ADM-3A terminal on which the H, J, K, L keys mapped to left, down, up, right - and it’s been that way ever since.

Here's the keyboard layout:

Enter image description here

A couple of other points of note on the ADM-3A layout:

  • Left of the Q: the escape key - somewhat handier than where it is on keyboards today, hence a good choice for switching between normal and insert modes.
  • Top right: the 'Home' key doubles as the tilde (~), which subsequently became shorthand for a Unix user's home directory.