HJKL keys

HJKL keys are a method of navigating a cursor around the screen in console program without using arrow keys or numpad. First appearing in vi, these keys are also used in many roguelike games.

Contents

vi

In command mode the keys do the following actions:

  • h moves the cursor left.
  • j moves the cursor down.
  • k moves the cursor up.
  • l moves the cursor right.

These keys are consistent with Ctrl-h for backspace (deleting the previous character, moving the cursor left) and Ctrl-j for line feed (moving the cursor to the next line).

Roguelikes

The HJKL keys were famously used in Rogue for moving the character, and many other roguelikes (like Nethack and Dungeon Crawl) have continued the tradition. Of course moving with arrow keys or numpad is also possible. For diagonal movement the following keys are used:

  • y for up-left
  • u for up-right
  • b for down-left
  • n for down-right

Also using these keys with Shift key makes the character run in that direction until something interrupts him/her.

These keys are also used in Robots.

Other uses

In the interactive fiction game Gostak, which is in a made-up language, "kirf", "jirf", "hoff", "loff" correspond to north, south, west, east directions. They could be abbreviated as k,j,h,l. The diagonal directions are called "kiloff", "kihoff", "jiloff" and "jihoff".

See also