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

31983Re: keymaps and Select mode

Expand Messages
  • Benji Fisher
    Apr 5, 2003
    • 0 Attachment
      Bram Moolenaar wrote:
      > Benji Fisher wrote:
      >
      >
      >> Another question about keymaps (and :lmap's). Did I miss an
      >>option, or do they not apply in Select mode? After
      >>
      >>:lnoremap a A
      >>:set iminsert
      >>
      >>I get "A" when I type "a" in Insert mode, but I get "a" if I type it in
      >>Select mode.
      >
      >
      > The problem here is that Vim doesn't know that the character you are
      > typing is going to be inserted. If it was a cursor movement command,
      > language mappings do not apply to it.
      >
      > 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". 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.

      I think this patch does way more than advertised. Maybe it is time to
      promote Select mode to full status, instead of keeping it as a sub-mode of
      Visual, and give it its own :smap's? (Probably not.) Anyway, Select mode is
      currently broken as far as keymaps (or :lmaps) are concerned, so I think it is
      worth trying again.

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