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

Distinguishing between and mappings in Windows.

Expand Messages
  • Jonathan Fudger
    I see that this question was asked back in 2009, (http://tech.groups.yahoo.com/group/vim/message/105903) but I thought I d raise it again to see if any
    Message 1 of 3 , Jan 21, 2013
    • 0 Attachment
      I see that this question was asked back in 2009, (http://tech.groups.yahoo.com/group/vim/message/105903) but I thought I'd raise it again to see if any progress had been made.

      I am using gvim 7.3.762 on Windows (XP and 7) but some of the mappings I am trying to implement are failing because the <kEnter> key cannot be mapped independently of <Enter>.

      To reproduce the problem, observe that the following mapping is not triggered by Enter or kEnter:

      :nnoremap <kEnter> :echo "kEnter"<CR>

      However, the following mapping is triggered by both Enter and kEnter:

      :nnoremap <Enter> :echo "Enter"<CR>

      I get the same result if I try using the termcap mapping <t_KA>. In Insert mode, both <c-v><Enter> and <c-v><kEnter> insert a ^M character. However, :echo "<\<Enter>>" outputs ">" whereas :echo "<\<kEnter>>" outputs "<<80>KA>. I'm not expert enough to know if these outputs are as expected. It looks like Vim is capable of distinguishing between the keys internally, but not when the keystrokes are supplied by Windows. Incidentally, everything works beautifully when I try it on Linux.

      I am very keen to solve this problem (either by a cunning workaround, or by a patch if it does turn out to be a bug in Vim).

      Thanks in advance,
      Jonathan.

      --
      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
    • John Little
      ... You can remap one of the keys in Windows. See in the Vim wiki: http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows It has a more general
      Message 2 of 3 , Jan 21, 2013
      • 0 Attachment
        On Monday, January 21, 2013 9:51:08 PM UTC+13, Jonathan Fudger wrote:

        > I am very keen to solve this problem (either by a cunning workaround, or by a patch if it does turn out to be a bug in Vim).

        You can remap one of the keys in Windows. See in the Vim wiki:
        http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows

        It has a more general discussion (than the title implies), and mentions some FOSS utilities that would avoid registry hacking.

        Note that vim on windows has f13, f14 and f15, though keyboards usually don't, so they become potential targets.

        It has long been recognized, and much discussed, that vim's key model has inadequacies, but the amount of code needing revision to fix it properly has, well, required a commitment that has not been forthcoming, though some are hopeful.

        Regards, John Little

        --
        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
      • Jonathan Fudger
        ... Thanks for your reply, you have clarified the situation for me, and the Autohotkey workaround looks very useful. You say that vim s key model is known to
        Message 3 of 3 , Jan 25, 2013
        • 0 Attachment
          On Monday, 21 January 2013 10:18:31 UTC, John Little wrote:
          > On Monday, January 21, 2013 9:51:08 PM UTC+13, Jonathan Fudger wrote:
          >
          > > I am very keen to solve this problem (either by a cunning workaround, or by a patch if it does turn out to be a bug in Vim).
          >
          > You can remap one of the keys in Windows. See in the Vim wiki:
          > http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows
          >
          > It has a more general discussion (than the title implies), and mentions some FOSS utilities that would avoid registry hacking.
          >
          > Note that vim on windows has f13, f14 and f15, though keyboards usually don't, so they become potential targets.
          >
          > It has long been recognized, and much discussed, that vim's key model has inadequacies, but the amount of code needing revision to fix it properly has, well, required a commitment that has not been forthcoming, though some are hopeful.
          >
          > Regards, John Little

          Thanks for your reply, you have clarified the situation for me, and the Autohotkey workaround looks very useful.

          You say that vim's key model is known to have inadequacies, but clearly Vim is capable internally of distinguishing <kEnter> from <Enter> (becuase it works on Linux). Presumably the bug here is that Vim is not correctly interpreting the information passed to it by Windows. Is this really so difficult to fix? I am not talking about overhauling Vim's entire key model, merely making mappings consistent across platforms.

          Thanks for your time,
          Regards,
          Jonathan.

          --
          --
          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.