I use an external keypad with a lapton, mainly with the numlock off for the arrow keys, as I'm a lefty. Ever since updating from Ubuntu 14.04 lts to 16.04 lts, the behavior has been somewhat different.

The keypad home and end keys work better now, as they now give the same control signal as the normal home and end keys. (ESC-[h AND ESC-[f, instead of ESC-[1~ and ESC-[4~) but the kp_begin is starting to drive me nuts when I use it in a terminal with either vim or emacs.

kp_begin is the function that the 5 key has with numlock off. In an emacs GUI, it moves to the very beginning of the document (similar to M-<). It never worked in the terminal window with emacs, which was fine. But now, it prints the number 5 to the screen in an emacs terminal, even if numlock is off. Accidentally hitting it instead of an arrow key gets irritating.

With vim, in the termial, the kp_begin used to have the same effect as the escape key. Now, it causes vim to enter insert mode, then prints a capital E and a newline character to the document. This is just as irritating, as I sometimes hit it instead of an arrow key.

There must be some way to restore its old behavior.

1 Answer 1


I found a solution. I can alter the behavior of the key with the code: [CODE] xmodmap -e "keycode NN = Begin KP_5 Begin KP_5" [/CODE] where NN is the keycode of the key in question. Apparently, KP_Begin is what was causing problems, so changing it to Begin solved things.

You must log in to answer this question.

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