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

How to Map Alt Key

Expand Messages
  • Ajay Jain
    Hi, I am using Vim (on Xterm). I am unable to map Alt key, i.e., map :w does not work. I have come across some documentation which suggests
    Message 1 of 7 , Jan 1, 2011
    • 0 Attachment
      Hi,

      I am using Vim (on Xterm). I am unable to map Alt key, i.e.,

      map <Alt-K> <Esc>:w<CR>
      does not work.

      I have come across some documentation which suggests why Alt key will
      not work. However, I have also come across the fact that it should
      work in Xterm by default.

      Can somebody help me to map an Alt combination?

      Thanks,
      Ajay.

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Anurag Priyam
      ... Try map foo . Works for me on Gvim. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you
      Message 2 of 7 , Jan 1, 2011
      • 0 Attachment
        > map <Alt-K> <Esc>:w<CR>

        Try "map <A-k> foo". Works for me on Gvim.

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Tony Mechelynck
        ... ...but beware that, to Vim, Alt-K (Alt + 0x4B) and Ë (uppercase E with diaeresis, 0xCB) are identical. If you use accented letters you may want to stay
        Message 3 of 7 , Jan 1, 2011
        • 0 Attachment
          On 02/01/11 07:29, Anurag Priyam wrote:
          >> map<Alt-K> <Esc>:w<CR>
          >
          > Try "map<A-k> foo". Works for me on Gvim.
          >

          ...but beware that, to Vim, Alt-K (Alt + 0x4B) and Ë (uppercase E with
          diaeresis, 0xCB) are identical. If you use accented letters you may want
          to stay away from alt-letter mappings to avoid masking accented letters.


          Best regards,
          Tony.
          --
          Only presidents, editors, and people with tapeworms have the right to
          use the editorial "we."

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • lainme
          You may use or -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For
          Message 4 of 7 , Jan 2, 2011
          • 0 Attachment
            You may use <A-K> or  <M-K>

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Ajay Jain
            ... This does not work for me. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to.
            Message 5 of 7 , Jan 11, 2011
            • 0 Attachment
              > Try "map <A-k> foo". Works for me on Gvim.

              This does not work for me.

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Ajay Jain
              ... This does not work either. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to.
              Message 6 of 7 , Jan 11, 2011
              • 0 Attachment
                > You may use <A-K> or  <M-K>

                This does not work either.

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • lainme
                I am not sure if xterm*eightBitInput: false and xterm*altSendsEscape: true is set in your machine. If set, you can disable it or put the following into your
                Message 7 of 7 , Jan 11, 2011
                • 0 Attachment
                  I am not sure if  xterm*eightBitInput: false and xterm*altSendsEscape: true is set in your machine.

                  If set, you can disable it or put the following into your .vimrc

                      for i in range(97,122)
                          let c = nr2char(i)
                          exec "set <M-".c.">=\<Esc>".c
                      endfor

                  "encoding" and  "fileencodings"  should be set after this.



                  On Tue, Jan 11, 2011 at 4:48 PM, Ajay Jain <ajay050@...> wrote:
                  > You may use <A-K> or  <M-K>

                  This does not work either.

                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php

                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                Your message has been successfully submitted and would be delivered to recipients shortly.