Unfortunately, while most terminals claim vt100 compatibility, they lot of them lack the so-called "application cursor mode". This is the only reasonable portable to use the keypad arrows, so #keypad won't work on those terminals. Terminals I checked: * Linux console: works just fine * PuTTY: works just fine * aterm: works just fine * rxvt: newer versions work fine, older ones have a bug that causes the down arrow to be misreported as the diagonal up-left one. This bug is hard-coded in rxvt -- so the only option that doesn't involve patching the source is upgrading to a newer version. * wterm: it's based on old rxvt code, and I'm not aware of a fixed version. Of course, you can just get the sources and apply this patch: --- command.c~ 2003-09-29 00:16:49.000000000 -0400 +++ command.c 2003-09-29 00:30:21.000000000 -0400 @@ -1562,11 +1562,11 @@ case XK_KP_Left: /* \033Ot or standard */ case XK_KP_Up: /* \033Ox or standard */ case XK_KP_Right: /* \033Ov or standard */ - case XK_KP_Down: /* \033Ow or standard */ + case XK_KP_Down: /* \033Or or standard */ if ((PrivateModes && PrivMode_aplKP) ? !shft : shft) { len = 3; STRCPY(kbuf, "\033OZ"); - kbuf[2] = ("txvw"[keysym - XK_KP_Left]); + kbuf[2] = ("txvr"[keysym - XK_KP_Left]); break; } else { /* translate to std. cursor key */ * Eterm: works just fine * gnome-terminal: in recent versions, the keypad is available in gnome-terminal's vt220 mode. Thus, KBtin will attempt to switch to it. Too bad, a few of the key codes are wrong -- KpadDivide is reported as KpadMinus, and KpadMinus as ESCOm. * konsole: doesn't work, and I'm not aware of a workaround * xterm: in many cases, it can be switched to an appropiate mode, with same problems as with gnome-terminal. Otherwise, it requires some tinkering with xmodmap. It seems that feeding the following to xmodmap will make #keypad work (making the NumLock key stuck as a side effect, though). keycode 79 = KP_7 keycode 80 = KP_8 keycode 81 = KP_9 keycode 83 = KP_4 keycode 84 = KP_5 keycode 85 = KP_6 keycode 87 = KP_1 keycode 88 = KP_2 keycode 89 = KP_3 keycode 90 = KP_0 keycode 91 = KP_Decimal (thanks Elariel for this solution!)