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

31991Re: keymaps and Select mode

Expand Messages
  • Benji Fisher
    Apr 6, 2003
    • 0 Attachment
      Bram Moolenaar wrote:
      > Benji Fisher wrote:
      >
      >
      >>>I can fix it to make the character mapped, but that means it will also
      >>>be mapped when it results from a ":noremap" command. Do we care about
      >>>this? It's not very likely that a ":noremap"'ed sequence starts Select
      >>>mode and inserts a character that should not be lmapped, is it? At
      >>>least it's more of a problem that the first inserted character isn't
      >>>keymapped.
      >>
      >>[patch snipped]
      >>
      >> Sorry to take so long. I just tried the patch. It seems that not only
      >>:lmap's get applied but also :imaps. Hm. After
      >>
      >>:imap r foo
      >>
      >>typing "r" in Select mode replaces the selection with "foo".
      >
      >
      > Yes, the patch makes the first typed character be mapped as if it was
      > typed in Insert mode. That's consistent, the second character typed
      > will be handled the same way.
      >
      >
      >>If, in addition, I do
      >>
      >>:vmap r R
      >>
      >>then typing "r" deletes the whole selection. It looks as though the
      >>:vmap makes vim switch from Select mode into Visual mode before
      >>applying the R.
      >
      >
      > Visual mode mappings apply in Select mode as if it were Visual mode.
      > Thus that's correct, even though it might not do what you want. I don't
      > think this has anything to do with the patch though.

      I know that :vmap's apply; that's why I tested it. I just think that this
      has to be well documented, since there is potential for confusion: which
      mapping applies if a :vmap and an :imap and an :lmap are all defined for a given
      character?

      Although, in principle, I am bothered by ignoring the "nore"
      specification, I like the way this patch works with my word-completion script,
      http://vim.sourceforge.net/scripts/script.php?script_id=73
      The script works by defining an :imap for each [a-z], automatically doing <C-P>,
      and highlighting the completion in Select mode. With unpatched vim, every other
      character is typed in Select mode, so completions are not offered. With the
      patch, the :imap's apply in Select mode, so it works much more smoothly.

      If you are willing to go ahead with such a big change, I will "make
      install" for further testing.

      --Benji Fisher
    • Show all 10 messages in this topic