I use VNC, open an xterm, and for example when I press "NumPad7", it completes "Home" command. Also "NumPad1" is mapped to "End". How to fix this?

In fact there is a code for .cshrc that does the work required. But unfortunately I can't translate it into a bash code. Please help me to translate. Here is the code:

if ($?TERM) then
    # fix the home, end, ins and del keys
    if ($TERM == "xterm" || $TERM == "vt100" || \
        $TERM == "vt102" || $TERM !~ "con*") then
        # bind keypad keys for xterm, vt100, vt102, console
        bindkey "\e[1~" beginning-of-line  # Home
        bindkey "\e[7~" beginning-of-line  # Home rxvt
        bindkey "\e[2~" overwrite-mode     # Ins
        bindkey "\e[3~" delete-char        # Delete
        bindkey "\e[4~" end-of-line        # End
        bindkey "\e[8~" end-of-line        # End rxvt
    endif
endif
link|improve this question

74% accept rate
feedback

1 Answer

You can try numlockx. It can set or toggle the state of numlock from the command line. To turn on numlock:

numlockx on

Now when you press NumPad7, for example, you'll get a 7.

It's available in these popular formats as well as at the link above:

link|improve this answer
Could you please be more specific? – Narek Feb 20 '11 at 8:18
@Narek: Please see my edited answer. – Dennis Williamson Feb 20 '11 at 14:43
No, the problem is that my numpad is ON, and the other numbers work correctly. Only 1 and 7 do not work. – Narek Feb 20 '11 at 15:08
@Narek: That's really weird. Try running xev and see if the output looks right. Check to see if something strange has been set using xmodmap. – Dennis Williamson Feb 20 '11 at 15:36
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.