Loading ...
Sorry, an error occurred while loading the content.
 

in xterm

Expand Messages
  • Vince Negri
    Hi all, I was setting up a box with SuSE 8.2 at work and a colleague came over to have a nose about ;) He cut his editing teeth on Brief and is therefore
    Message 1 of 2 , Apr 30, 2003
      Hi all,

      I was setting up a box with SuSE 8.2 at work and a colleague
      came over to have a nose about ;) He cut his editing teeth
      on Brief and is therefore programmed to have the numeric
      keypad + and - as "copy" and "cut".

      I recalled that the xterm termcap included entries for
      <kPlus> and <kMinus> and so proceeded to demo how these
      keys could be independently mapped:

      :imap <kPlus> hello

      .. but the keypad + continued to produce merely a "+" in
      insert mode.

      Now, I should point out that prior to this I'd never
      tried mapping <kPlus> on a un*x box, so I don't know if
      this is something I should expect to work or not work.

      Is it possible that XFree86 4.3, or KDE3.1, are "helpfully"
      turning the keypad plus to a normal plus before vim
      receives it?

      Vince


      Legal Disclaimer: Any views expressed by the sender of this message are
      not necessarily those of Application Solutions Ltd. Information in this
      e-mail may be confidential and is for the use of the intended recipient
      only, no mistake in transmission is intended to waive or compromise such
      privilege. Please advise the sender if you receive this e-mail by mistake.
    • Neil Bird
      Around about 30/04/2003 16:03, Vince Negri typed ... ... [is this really vim-dev?] There are a no. of things that could be happening, and a greater no. of ways
      Message 2 of 2 , May 1, 2003
        Around about 30/04/2003 16:03, Vince Negri typed ...
        > :imap <kPlus> hello
        > .. but the keypad + continued to produce merely a "+" in
        > insert mode.

        [is this really vim-dev?]

        There are a no. of things that could be happening, and a greater no.
        of ways to fix 'em :-)

        Try <Ctrl-V><kPlus> in xterm at the prompt and see what you get.
        Also try it with num-lock set.

        I've heavily customised my XTerm defaults file to ensure I get
        different key-sequences for nearly every key with every modifier for
        this very purpose, so I've no idea what the defaults are!


        E.g., in your fav. xdefaults file (pref. $XAPPLRESDIR/XTerm), the
        following[snipped from mine - makes the KP keys work 'normally' with
        num-lock on, and vim-mapping-friendly without]. I'm not certain <kPlus>
        will work - depends what escape sequence vim thinks that is. You might
        be able to tweak the defs. below to match, or else just map
        <esc>whatever instead. The mappings below are what I figured were the
        correct ones by examining xterm source (!) & VT manuals.


        XTerm*VT100.Translations: #override \
        @Num_Lock<Key>KP_Add: string("+") \n\
        @Num_Lock<Key>KP_Subtract:string("-") \n\
        @Num_Lock<Key>KP_Decimal: string(".") \n\
        @Num_Lock<Key>KP_Divide: string("/") \n\
        @Num_Lock<Key>KP_Insert: string("0") \n\
        @Num_Lock<Key>KP_Enter: string(0x0a) \n\
        ! <Key>KP_Multiply: string(0x1b) string("Oj") \n\
        !s <Key>KP_Multiply: string(0x1b) string("O2j") \n\
        ! a <Key>KP_Multiply: string(0x1b) string("O3j") \n\
        !s a <Key>KP_Multiply: string(0x1b) string("O4j") \n\
        ! c <Key>KP_Multiply: string(0x1b) string("O5j") \n\
        !s c <Key>KP_Multiply: string(0x1b) string("O6j") \n\
        ! a c <Key>KP_Multiply: string(0x1b) string("O7j") \n\
        !s a c <Key>KP_Multiply: string(0x1b) string("O8j") \n\
        ! <Key>KP_Add: string(0x1b) string("Ok") \n\
        !s <Key>KP_Add: string(0x1b) string("O2k") \n\
        ! a <Key>KP_Add: string(0x1b) string("O3k") \n\
        !s a <Key>KP_Add: string(0x1b) string("O4k") \n\
        ! c <Key>KP_Add: string(0x1b) string("O5k") \n\
        !s c <Key>KP_Add: string(0x1b) string("O6k") \n\
        ! a c <Key>KP_Add: string(0x1b) string("O7k") \n\
        !s a c <Key>KP_Add: string(0x1b) string("O8k") \n\
        ! <Key>KP_Subtract: string(0x1b) string("Om") \n\
        !s <Key>KP_Subtract: string(0x1b) string("O2m") \n\
        ! a <Key>KP_Subtract: string(0x1b) string("O3m") \n\
        !s a <Key>KP_Subtract: string(0x1b) string("O4m") \n\
        ! c <Key>KP_Subtract: string(0x1b) string("O5m") \n\
        !s c <Key>KP_Subtract: string(0x1b) string("O6m") \n\
        ! a c <Key>KP_Subtract: string(0x1b) string("O7m") \n\
        !s a c <Key>KP_Subtract: string(0x1b) string("O8m") \n\
        ! <Key>KP_Decimal: string(0x1b) string("On") \n\
        !s <Key>KP_Decimal: string(0x1b) string("O2n") \n\
        ! a <Key>KP_Decimal: string(0x1b) string("O3n") \n\
        !s a <Key>KP_Decimal: string(0x1b) string("O4n") \n\
        ! c <Key>KP_Decimal: string(0x1b) string("O5n") \n\
        !s c <Key>KP_Decimal: string(0x1b) string("O6n") \n\
        ! a c <Key>KP_Decimal: string(0x1b) string("O7n") \n\
        !s a c <Key>KP_Decimal: string(0x1b) string("O8n") \n\
        ! <Key>KP_Divide: string(0x1b) string("Oo") \n\
        !s <Key>KP_Divide: string(0x1b) string("O2o") \n\
        ! a <Key>KP_Divide: string(0x1b) string("O3o") \n\
        !s a <Key>KP_Divide: string(0x1b) string("O4o") \n\
        ! c <Key>KP_Divide: string(0x1b) string("O5o") \n\
        !s c <Key>KP_Divide: string(0x1b) string("O6o") \n\
        ! a c <Key>KP_Divide: string(0x1b) string("O7o") \n\
        !s a c <Key>KP_Divide: string(0x1b) string("O8o") \n\
        ! <Key>KP_Insert: string(0x1b) string("Op") \n\
        !s <Key>KP_Insert: string(0x1b) string("O2p") \n\
        ! a <Key>KP_Insert: string(0x1b) string("O3p") \n\
        !s a <Key>KP_Insert: string(0x1b) string("O4p") \n\
        ! c <Key>KP_Insert: string(0x1b) string("O5p") \n\
        !s c <Key>KP_Insert: string(0x1b) string("O6p") \n\
        ! a c <Key>KP_Insert: string(0x1b) string("O7p") \n\
        !s a c <Key>KP_Insert: string(0x1b) string("O8p") \n\
        ! <Key>KP_Enter: string(0x1b) string("OM") \n\
        !s <Key>KP_Enter: string(0x1b) string("O2M") \n\
        ! a <Key>KP_Enter: string(0x1b) string("O3M") \n\
        !s a <Key>KP_Enter: string(0x1b) string("O4M") \n\
        ! c <Key>KP_Enter: string(0x1b) string("O5M") \n\
        !s c <Key>KP_Enter: string(0x1b) string("O6M") \n\
        ! a c <Key>KP_Enter: string(0x1b) string("O7M") \n\
        !s a c <Key>KP_Enter: string(0x1b) string("O8M")


        --
        [neil@fnx ~]# rm -f .signature
        [neil@fnx ~]# ls -l .signature
        ls: .signature: No such file or directory
        [neil@fnx ~]# exit
      Your message has been successfully submitted and would be delivered to recipients shortly.