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

Langmap bug? ('Alt-key' hotkeys)

Expand Messages
  • Valery Kondakoff
    Hello, vim-developers! Yesterday I unsuccsessfully tried to add Alt-key mapping to my GVIM 6.1 (WinXP Pro). All the night I was trying to track down - what s
    Message 1 of 6 , Mar 14, 2003
    • 0 Attachment
      Hello, vim-developers!

      Yesterday I unsuccsessfully tried to add 'Alt-key' mapping to my
      GVIM 6.1 (WinXP Pro). All the night I was trying to track down -
      what's wrong and finaly I have found a reason for this strange
      behaviour!

      It looks, like there is a bug in current langmap implementation (as
      far as I understand).

      Bug short description: it is impossible to use 'Alt-key' hotkeys
      when using langmaps.

      Steps to reproduce:

      Create a simple _vimrc like this one:

      >8<======================<start>======================>8< set
      nocompatible " no vi compatibility

      " Alt-mappings:
      map <A-x> itest<Esc>
      >8<=======================<end>=======================>8<

      Start GVIM and try 'Alt-x' hotkey. Does it works? Yes, of course:
      it starts Insert mode, types 'test' and returns back to Normal
      mode.

      Now change _vimrc like this, and restart GVIM:

      >8<======================<start>======================>8<
      set nocompatible " no vi compatibility

      " Map keys for CP1251
      set langmap=ЙQ,ЦW,УE,КR,ЕT,НY,ГU,ШI,ЩO,ЗP,Х{,Ъ},ФA,ЫS,ВD,АF,ПG
      set langmap+=РH,ОJ,ЛK,ДL,Ж:,Э\",ЯZ,ЧX,СC,МV,ИB,ТN,ЬM,Б<,Ю>
      set langmap+=йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ъ],фa,ыs,вd,аf,пg
      set langmap+=рh,оj,лk,дl,ж\\;,э',яz,чx,сc,мv,иb,тn,ьm,б\,,ю.

      " Alt-mappings:
      map <A-x> itest<Esc>
      >8<=======================<end>=======================>8<

      After this 'Alt-x' will stop working correctly: it will start to
      insert a Russian letter 'ш' that is near the Latin 'i' in langmap.

      You can even make _vimrc shorter:

      >8<======================<start>======================>8<
      set nocompatible " no vi compatibility

      " Map keys for CP1251
      set langmap=шi

      " Alt-mappings:
      map <A-x> itest<Esc>
      >8<=======================<end>=======================>8<

      The 'Alt-x' will not work with this example. Of course, this issue
      is reproducible not only with 'Alt-x', but with all others 'Alt-key'
      hotkeys, that have langmap 'pairs' defined. BTW - current language
      layout (Russian/English) does not change the situation.

      Please, explain me - what's wrong there? If this is a bug, or am I
      doing smth wrong?

      I'm ready to give all additional explanation from my side and to
      perform some testing that you will need - I really want to help GVIM
      to get better! :)

      Thank you.



      --
      Best regards,
      Valery Kondakoff
      http://www.nbk.orc.ru (Ne Bey Kopytom)
      http://www.nbk.orc.ru/mtb (MTB riding in Moscow)

      PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...

      np: New Order - Run (Technique)
    • Bram Moolenaar
      ... You are doing something wrong. Apparently your produces Û. You can t both langmap this character and :map it at the same time. You will have to
      Message 2 of 6 , Mar 14, 2003
      • 0 Attachment
        Valery Kondakoff wrote:

        > >8<======================<start>======================>8<
        > set nocompatible " no vi compatibility
        >
        > " Map keys for CP1251
        > set langmap=Ûi
        >
        > " Alt-mappings:
        > map <A-x> itest<Esc>
        > >8<=======================<end>=======================>8<
        >
        > The 'Alt-x' will not work with this example. Of course, this issue
        > is reproducible not only with 'Alt-x', but with all others 'Alt-key'
        > hotkeys, that have langmap 'pairs' defined. BTW - current language
        > layout (Russian/English) does not change the situation.
        >
        > Please, explain me - what's wrong there? If this is a bug, or am I
        > doing smth wrong?

        You are doing something wrong. Apparently your <A-X> produces Û.
        You can't both 'langmap' this character and ":map" it at the same time.
        You will have to make a choice. You probably want the ":map" to apply
        when you can type an "i" directly, and the 'langmap' to apply when your
        normal "i" key produces Û.

        --
        Proof techniques #2: Proof by Oddity.
        SAMPLE: To prove that horses have an infinite number of legs.
        (1) Horses have an even number of legs.
        (2) They have two legs in back and fore legs in front.
        (3) This makes a total of six legs, which certainly is an odd number of
        legs for a horse.
        (4) But the only number that is both odd and even is infinity.
        (5) Therefore, horses must have an infinite number of legs.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
      • Valery Kondakoff
        Hello, Bram! ... BM You are doing something wrong. Apparently your produces Û. Yes, it seems this is an important point. I just checked it with this
        Message 3 of 6 , Mar 14, 2003
        • 0 Attachment
          Hello, Bram!

          14 ìàðòà 2003 ã., you wrote to me:

          >> >8<======================<start>======================>8<
          >> set nocompatible " no vi compatibility
          >>
          >> " Map keys for CP1251
          >> set langmap=Ûi
          >>
          >> " Alt-mappings:
          >> map <A-x> itest<Esc>
          >> >8<=======================<end>=======================>8<
          >>
          >> The 'Alt-x' will not work with this example. Of course, this issue
          >> is reproducible not only with 'Alt-x', but with all others 'Alt-key'
          >> hotkeys, that have langmap 'pairs' defined. BTW - current language
          >> layout (Russian/English) does not change the situation.
          >>
          >> Please, explain me - what's wrong there? If this is a bug, or am I
          >> doing smth wrong?

          BM> You are doing something wrong. Apparently your <A-X> produces Û.

          Yes, it seems this is an important point. I just checked it with this
          _vimrc:

          >8<======================<start>======================>8<
          set nocompatible " no vi compatibility
          >8<=======================<end>=======================>8<

          Successive 'Alt-key' pressings in Insert mode are entering strange
          characters in text area. For example, when Windows keyboard layout is
          set to 'En' pressing <Alt-z><Alt-x><Alt-c><Alt-v> enters the string
          'úøãö' in text area. The next press (Alt-b) will trigger the 'Buffers'
          menu etc.

          When Windows keyboard layout is set to 'Ru' the same keypresses will
          show these symbols in GVIM statusline:
          >^A, >^I, >^O, >^T etc...

          I have no idea why these characters are entered and how to get rid of
          this. I can't reproduce this behavior in any other editor installed on
          my system.

          I just want to mention, that this is reproducible on two PCs with
          WinXP installed. And GVIM was started with empty _vimrc.

          Do you want to track down this issue? Can I help you with this? Do I
          need to produce screenshot, that illustrates the problem? Or maybe I
          can do some testing for you?

          BM> You can't both 'langmap' this character and ":map" it at the same time.
          BM> You will have to make a choice. You probably want the ":map" to apply
          BM> when you can type an "i" directly, and the 'langmap' to apply when your
          BM> normal "i" key produces Û.

          --
          Best regards,
          Valery Kondakoff
          http://www.nbk.orc.ru (Ne Bey Kopytom)
          http://www.nbk.orc.ru/mtb (MTB riding in Moscow)

          PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...
        • Bram Moolenaar
          ... Please check your mail software, this isn t right! ... That s all very normal. Alt-keys are used to enter special characters by setting the 8th bit of the
          Message 4 of 6 , Mar 14, 2003
          • 0 Attachment
            Valery Kondakoff wrote:

            > Cc: Bram Moolenaar <vim-multibyte@...>

            Please check your mail software, this isn't right!

            > Successive 'Alt-key' pressings in Insert mode are entering strange
            > characters in text area. For example, when Windows keyboard layout is
            > set to 'En' pressing <Alt-z><Alt-x><Alt-c><Alt-v> enters the string
            > 'úøãö' in text area. The next press (Alt-b) will trigger the 'Buffers'
            > menu etc.

            That's all very normal. Alt-keys are used to enter special characters
            by setting the 8th bit of the ASCII character. That's all very normal.

            --
            If bankers can count, how come they have eight windows and
            only four tellers?

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
          • Tony Mechelynck
            Valery Kondakoff wrote: [...] ... [...] I have problems with gvim too, when Windows keyboard encoding is not latin. While in gvim, I prefer to
            Message 5 of 6 , Mar 14, 2003
            • 0 Attachment
              Valery Kondakoff <strauss@...> wrote:
              [...]
              > Successive 'Alt-key' pressings in Insert mode are entering strange
              > characters in text area. For example, when Windows keyboard layout is
              > set to 'En' pressing <Alt-z><Alt-x><Alt-c><Alt-v> enters the string
              > 'úøãö' in text area. The next press (Alt-b) will trigger the 'Buffers'
              > menu etc.
              >
              > When Windows keyboard layout is set to 'Ru' the same keypresses will
              > show these symbols in GVIM statusline:
              > > ^A, >^I, >^O, >^T etc...
              [...]

              I have problems with gvim too, when Windows keyboard encoding is not latin.
              While in gvim, I prefer to leave the Windows keyboard on [Fr] always, vim
              'encoding' on iso-8859-15 for pure "Western" Latin text or utf-8 for
              anything else including Esperanto, and use digraphs (see :help digraphs) or
              Unicode hex (see :help i_CTRL-V_digit) for Russian, Arabic, or the "special"
              consonants of Esperanto. (But of course I type more Latin-script text than
              Cyrillic or Arabic.) I suppose that your 'termencoding' should agree with
              your keyboard encoding, meaning changing from [En] to [Ru] in Windows might
              (?) require changing 'tenc' too. But I'm not sure.

              Regards,
              Tony.
            • Valery Kondakoff
              Hello, Bram! ... BM Please check your mail software, this isn t right! Fixed. ... BM That s all very normal. Alt-keys are used to enter special characters
              Message 6 of 6 , Mar 14, 2003
              • 0 Attachment
                Hello, Bram!

                15 ìàðòà 2003 ã., you wrote to me:

                >> Cc: Bram Moolenaar <vim-multibyte@...>
                BM> Please check your mail software, this isn't right!

                Fixed.

                >> Successive 'Alt-key' pressings in Insert mode are entering strange
                >> characters in text area. For example, when Windows keyboard layout is

                BM> That's all very normal. Alt-keys are used to enter special characters
                BM> by setting the 8th bit of the ASCII character. That's all very normal.

                OK. Thank you for explanations. Switching to 'utf-8' and keymaps.

                --
                Best regards,
                Valery Kondakoff
                http://www.nbk.orc.ru (Ne Bey Kopytom)
                http://www.nbk.orc.ru/mtb (MTB riding in Moscow)

                PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...
              Your message has been successfully submitted and would be delivered to recipients shortly.