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

[Feature Request]: &metasendsescape

Expand Messages
  • Herculano de Lima Einloft Neto
    I m writing because I can t find a satisfactory workaround for the problem of sharing a .vimrc between vim on terminals with meta sending escape and gvim. Even
    Message 1 of 6 , Nov 28, 2004
    • 0 Attachment
      I'm writing because I can't find a satisfactory workaround for the
      problem of sharing
      a .vimrc between vim on terminals with meta sending escape and gvim.
      Even the hacky
      loops with ``exec 'set <M-' . c . ">=\e" . c'' are a pain to cover all
      combinations, like <M-C-c>.
      I suggest an option which would understand mappings with <M-c> as <Esc>c
      (which is
      what I use in my .vimrc). That way we could use the uniform notation
      <M-c> in all files.

      Cheers,
      --
      Herculano de Lima Einloft Neto
      <hlen@...>
    • Bram Moolenaar
      ... Prepending for keys with Alt or Meta pressed is a very bad choice. If Vim receives c it does not know if this was or the two keys
      Message 2 of 6 , Nov 29, 2004
      • 0 Attachment
        Herculano de Lima Einloft Neto wrote:

        > I'm writing because I can't find a satisfactory workaround for the
        > problem of sharing a .vimrc between vim on terminals with meta sending
        > escape and gvim. Even the hacky loops with ``exec 'set <M-' . c .
        > ">=\e" . c'' are a pain to cover all combinations, like <M-C-c>.
        > I suggest an option which would understand mappings with <M-c> as
        > <Esc>c (which is what I use in my .vimrc). That way we could use the
        > uniform notation <M-c> in all files.

        Prepending <Esc> for keys with Alt or Meta pressed is a very bad choice.
        If Vim receives <Esc>c it does not know if this was <M-c> or the two
        keys <Esc> and c. Do not use this method.

        If you do not want to set the 8th bit when the Alt key is pressed, then
        use the <CSI> code prepended to the character. You still need to handle
        the mappings yourself then, since the termcap/terminfo system has no way
        to specify this.

        --
        It is illegal to take more than three sips of beer at a time while standing.
        [real standing law in Texas, United States of America]

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
      • Herculano de Lima Einloft Neto
        ... I see your point. I have one question, though.. relying on the terminal sending the 8th bit works fine with non unicode locales, but utf-8 seems to break
        Message 3 of 6 , Nov 30, 2004
        • 0 Attachment
          Bram Moolenaar wrote:

          >Herculano de Lima Einloft Neto wrote:
          >
          >
          >
          >>I'm writing because I can't find a satisfactory workaround for the
          >>problem of sharing a .vimrc between vim on terminals with meta sending
          >>escape and gvim. Even the hacky loops with ``exec 'set <M-' . c .
          >>">=\e" . c'' are a pain to cover all combinations, like <M-C-c>.
          >>I suggest an option which would understand mappings with <M-c> as
          >><Esc>c (which is what I use in my .vimrc). That way we could use the
          >>uniform notation <M-c> in all files.
          >>
          >>
          >
          >Prepending <Esc> for keys with Alt or Meta pressed is a very bad choice.
          >If Vim receives <Esc>c it does not know if this was <M-c> or the two
          >keys <Esc> and c. Do not use this method.
          >
          >If you do not want to set the 8th bit when the Alt key is pressed, then
          >use the <CSI> code prepended to the character. You still need to handle
          >the mappings yourself then, since the termcap/terminfo system has no way
          >to specify this.
          >
          >
          I see your point. I have one question, though.. relying on the terminal
          sending
          the 8th bit works fine with non unicode locales, but utf-8 seems to break
          things. Is it possible to make the <M-c> mappings work with utf-8 on xterm,
          for instance?

          --
          Herculano de Lima Einloft Neto
          <hlen@...>
        • Bram Moolenaar
          ... Pressing Alt-a has the effect of lll . Make sure encoding is set to utf-8 before the mappings are defined, otherwise it might not work. Changing
          Message 4 of 6 , Nov 30, 2004
          • 0 Attachment
            Herculano de Lima Einloft Neto wrote:

            > I see your point. I have one question, though.. relying on the terminal
            > sending the 8th bit works fine with non unicode locales, but utf-8
            > seems to break things. Is it possible to make the <M-c> mappings work
            > with utf-8 on xterm, for instance?

            It works for me:

            :map <M-a> lll

            Pressing Alt-a has the effect of "lll".

            Make sure 'encoding' is set to "utf-8" before the mappings are defined,
            otherwise it might not work. Changing 'encoding' while Vim is running
            has many side effects. Best is to set it as early as possible and leave
            it alone.

            --
            The MS-Windows registry is no more hostile than any other bunch of state
            information... that is held in a binary format... a format that nobody
            understands... and is replicated and cached in a complex and largely
            undocumented way... and contains large amounts of duplicate and obfuscated
            information... (Ben Peterson)

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
          • Herculano de Lima Einloft Neto
            ... Ok, I ll gladly take your word for it, even though I couldn t make it work here. One issue bugs me: as much as it is easy to get your terminal to behave
            Message 5 of 6 , Nov 30, 2004
            • 0 Attachment
              Bram Moolenaar wrote:

              >It works for me:
              >
              > :map <M-a> lll
              >
              >Pressing Alt-a has the effect of "lll".
              >
              >Make sure 'encoding' is set to "utf-8" before the mappings are defined,
              >otherwise it might not work. Changing 'encoding' while Vim is running
              >has many side effects. Best is to set it as early as possible and leave
              >it alone.
              >
              >
              Ok, I'll gladly take your word for it, even though I couldn't make it
              work here.

              One issue bugs me: as much as it is easy to get your terminal to behave
              the right way when you're using xterm, standard terminals like the
              linux console and gnome-terminal default to sending an ESC prefix, and
              there appears to be no easy (at least findable) way to change that! Just
              ima-
              gine how many console/gnome-terminal users have been bugged by the
              fact their <M-c> maps don't work. I had to write an ioctl() C snippet to
              change that in the console, but I can't find any way to do it with gnome-
              terminal, as much as I suspect there might be an obscure control sequence.
              This is a problem which, in my point of view, should be considered with
              attention, and mentioned with care in the docs.

              Best,
              --
              Herculano de Lima Einloft Neto
              <hlen@...>
            • Bram Moolenaar
              ... There were a few xterm versions that produced illegal utf-8 byte sequences for Alt-key combinations. You could try installing a newer one. Version 197 is
              Message 6 of 6 , Dec 1, 2004
              • 0 Attachment
                Herculano de Lima Einloft Neto wrote:

                > Bram Moolenaar wrote:
                >
                > >It works for me:
                > >
                > > :map <M-a> lll
                > >
                > >Pressing Alt-a has the effect of "lll".
                > >
                > >Make sure 'encoding' is set to "utf-8" before the mappings are defined,
                > >otherwise it might not work. Changing 'encoding' while Vim is running
                > >has many side effects. Best is to set it as early as possible and leave
                > >it alone.
                > >
                > >
                > Ok, I'll gladly take your word for it, even though I couldn't make it
                > work here.

                There were a few xterm versions that produced illegal utf-8 byte
                sequences for Alt-key combinations. You could try installing a newer
                one. Version 197 is just out: ftp://invisible-island.net/xterm

                > One issue bugs me: as much as it is easy to get your terminal to behave
                > the right way when you're using xterm, standard terminals like the
                > linux console and gnome-terminal default to sending an ESC prefix, and
                > there appears to be no easy (at least findable) way to change that!

                I think you should report that as a bug: Pressing a key with Alt can't
                be distinguished from pressing Esc and that key.

                > Just imagine how many console/gnome-terminal users have been bugged by the
                > fact their <M-c> maps don't work. I had to write an ioctl() C snippet to
                > change that in the console, but I can't find any way to do it with gnome-
                > terminal, as much as I suspect there might be an obscure control sequence.
                > This is a problem which, in my point of view, should be considered with
                > attention, and mentioned with care in the docs.

                Unfortunately, there are programmers around that don't understand the
                implications of the ideas they have. It probably looked like a good
                idea to them. It takes a while to find out the disadvantages of a
                solution. Some people try to ignore the disadvantages...

                --
                SUPERIMPOSE "England AD 787". After a few more seconds we hear hoofbeats in
                the distance. They come slowly closer. Then out of the mist comes KING
                ARTHUR followed by a SERVANT who is banging two half coconuts together.
                "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
              Your message has been successfully submitted and would be delivered to recipients shortly.