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

54856Re: Windows vista alt key mapping

Expand Messages
  • Tony Mechelynck
    Aug 16, 2009
    • 0 Attachment
      On 09/08/09 08:17, Ian00 wrote:
      >
      > What does "set enc? fenc? fencs?" print out if you
      >> put it in _vimrc? If you run that line manually?
      >
      > Looks like you were on to something.
      > fenc=utf-8
      > enc=utf-8
      > fencs=ucs-bom,utf-8,default,latin1
      >
      > In my .vimrc, I had this
      > set encoding=utf-8
      > when I put the the keymaps after that line in .vimrc, they work,
      > before that line, they don't work. Without that line, they work.

      See the first "NOTE" under ":help 'encoding'", where "the existing text
      in Vim" refers to _all_ text in Vim memory, not only files being edited,
      but also mappings and options.

      When you set 'encoding' to UTF-8, any preexisting mappings and options
      (and edited text, but in your vimrc the editfile is normally not yet
      loaded) whose values include characters above 0x7F (including Alt key
      combos, because Vim represents the Alt key modifier by setting the 0x80
      bit) become invalid, because any character above 0x7F requires at least
      two bytes in UTF-8. Defining your mappings after setting 'encoding' to
      UTF-8 takes care of that, and represents e.g. Alt-a (or a-acute, see
      below) as U+00E1, or internally as 0xC3 0xA1. Before you change
      'encoding', it is still set to your locale's default -- probably
      Windows-1252, in "Western" countries on Windows, which would mean Alt-a
      = á = 0xE1 (one byte in memory).

      This high-bit representation also explains what you saw:

      a = 0x61 Alt-a = 0xE1 = á
      b = 0x62 Alt-b = 0xE2 = â
      c = 0x63 Alt-c = 0xE3 = ã
      ...etc...
      x = 0x78 Alt-x = 0xF8 = ø
      y = 0x79 Alt-y = 0xF9 = ù
      z = 0x7A Alt-z = 0xFA = ú

      Note that Vim can never see any difference between these Alt combos and
      the corresponding accented letters. If you use Alt-a as the {lhs} of a
      mapping, a-acute will also trigger that mapping, and vice-versa.

      Note also that unlike with Ctrl, Alt does not swallow Shift: Alt-a is
      not the same as Alt-A (which is Alt-Shift-a).


      Best regards,
      Tony.
      --
      The only thing to do with good advice is pass it on. It is never any
      use to oneself.
      -- Oscar Wilde

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 4 messages in this topic