I recently downloaded NetHack, and have begun to play on my laptop. However, I find the directional key bindings rather cumbersome. I do not have a Number Pad, and would rather not use the NumLock function on my laptop's keyboard. So, I'm currently left to deal with the default non-numerical bindings for movement. These are very counter-intuitive.

The help file displays them as this:

y k u
b j n

When, in reality, they're laid out more like this:


Is there any way to change this key binding to be less confusing - perhaps even using the actual directional keypad?

  • 10
    The good news is that after all that nethack, you'll be a whiz at VI!
    – Robb
    Jan 14, 2011 at 5:30
  • You might think so but try playing ADOM after playing nethack or vica-versa!
    – NibblyPig
    Apr 7, 2014 at 10:48

7 Answers 7


As far as I know, there's no way to remap the keys outside of a recompiling from source, or a crazy hack like using AutoHotKey to map entirely different keys on the keyboard to hjkl/yubn. Obviously that has side-effects though.

So you have a couple of options:

  1. You may not have an actual numpad, but most laptops have a mode that can "convert" part of the keyboard into a numpad, by holding down the "Fn" key, or using a "Fn Lock" key to toggle it on/off.
  2. Get used to hjkl/yubn, and be glad that if you ever decide to learn how to use vim in the future, you'll already have moving around with hjkl solidly ingrained into your muscle memory.
  • I found that vikeys was confusing for a few hours, but after that it feels just as natural as the keypad, and is a lot less painful on the hands.
    – Wooble
    Jan 14, 2011 at 3:51
  • Really? It's not just NetHack? What sadistic bofh came up with this?
    – Iszi
    Jan 14, 2011 at 20:45
  • @lszi: As I understand it, the idea is that it doesn't require you to move your fingers away from the home row at all. It doesn't take long to get used to, I'm a vim user and don't even have to think about it any more at all.
    – Chad Birch
    Jan 16, 2011 at 17:45
  • Honestly, in Vi, you don't really use directional keys either. You stick to the keys that bring you exactly where you want to be. @Iszi Terminals that did not have arrow keys needed something. Some chose WASD, some chose HJKL.
    – user56
    Jan 19, 2011 at 14:00
  • 3
    @Iszi: A long, long time ago, there actually were arrows on the hjkl keys of the keyboard, so mapping them to left, up, down, right was natural.
    – Trevoke
    Jan 30, 2011 at 2:08

You don't say which version of Nethack you're using, but I think most of the GUI clients should support directional keys. The Windows port definitely does.

  • Could you provide a link to the port that you're talking about? I don't think it's the same one I'm using.
    – Iszi
    Feb 13, 2011 at 4:29
  • @Iszi I'm talking about nethackw.exe from the official Windows port.
    – user56
    Feb 13, 2011 at 9:21
  • I still am not finding the option. Could you post instructions to your answer? Thanks.
    – Iszi
    Feb 14, 2011 at 3:40
  • @Iszi There aren't really instructions, you just launch the game, press up to go up, down to go down, left to go left and right to go right.
    – user56
    Feb 14, 2011 at 5:52
  • I have to go with Arda on this one....I use nethackw.exe all the time now and use the direction keys just fine.
    – erik
    Mar 10, 2011 at 18:13

You cannot change the movement keys because they are unfortunately hardcoded in the source code. Not everyone is using a layout close to qwerty so it is very unfortunate.

However you can recompile the source to change the keys. I have created a patch that change the keys:


You can adapt it to specify the keys you want, in my case it was done to be convenient with the Colemak Mod DH layout.

Compilation instructions of NetHack are in the repo: https://github.com/NetHack/NetHack. Recompiling NetHack is not as complex as it seems. Good luck!

I hope this post helps people searching for a solution.


If you edit the default.nh file in the game's root directory, you can set 'number_pad:1' or 2 to use the numpad for movement. See the guidebook for more details. Doing this also frees up letter keys for other commands, and won't cause confusions later if you map inventory items to consistent letters.

Having your movement keys in one place controlling nothing but movement is a much more sensible control layout than vim uses; I don't know why everyone has to give you a hard time instead of giving the simple answer.

  • Reading the question notes that the original poster does not have a numpad. Also, IIRC, the Windows port does default to the numpad. Apr 3, 2014 at 0:23
  • @DoktoroReichard this could still be helpful for someone else
    – shanodin
    Apr 3, 2014 at 4:47

Somewhat inspired by Cameron's answer, there may be another option to actually change the keyboard layout. Note however that this should only work on the Windows tty version of the game. To correct some keyboard localization issues, the OPTIONS=subkeyvalue:x/y allows for one given character to be replaced by another, as stated in the 3.4.3 Guidebook

The fact is that this seems not to work, as I have tested this myself to no avail. All research I found on the net seems to indicate that either this only works for the Finnish problem or that no one was able to make it work.

Thus, Nethack offers no solution to this problem. Another possible way to circumvent this is by using programs such as SharpKeys (which allows for easy registry-based mapping) or AutoHotKey, with the caveats I mentioned earlier about losing functionality. To sum it up, Nethack is so filled with commands that trying to remap other keys will remove some functionality from the game.


On my version of nethack (got it Feb. 2016 from the site) you simply go through the options menu using shift-O, and look for the "number_pad" option. I can edit that to switch control modes freely. I don't know if it works for you on a laptop, but for me it allows me to use the directional keys rather than the number pad.


Type shift-o, switch altmeta to [true], so you can use the meta key commands, scroll with the space bar, type in the command for number_pad, switch that to [1=on], turn your NumLock on and you're good to go.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .