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

42700Re: onoremap with :set insertmode

Expand Messages
  • Bram Moolenaar
    Apr 3, 2006
      Georg Dahn wrote:

      > I have seen a surprising (to me) behavior of Vim
      > today:
      > 1. Define the mapping
      > onoremap <F3> <C-C>n
      > 2. and do
      > :set insertmode
      > You are in Insertmode now
      > 3. Do <C-O>
      > 4. Do d
      > You are in Operator pending mode now
      > 5. Do <F3>
      > The result: not the next pattern is searched for, but
      > 'n' is inserted. I consider, that <C-C> of the mapping
      > switches back to Insert mode.
      > Is this the normal behavior or shouldn't Vim return to
      > Insert mode not before the mapping has finished? If
      > 'insertmode' is not set, this is the actual behavior
      > of Vim when doing the same thing.

      Well, the CTRL-C aborts the current command. When 'insertmode' is set
      Vim goes back to Insert mode. I can't say this is wrong. Setting
      'insertmode' changes a lot of things.

      Perhaps what should happen is that CTRL-C should forget about the rest
      of the mapping. But that would break existing mappings, thus we can't
      do that.

      CART DRIVER: Bring out your dead!
      LARGE MAN: Here's one!
      CART DRIVER: Ninepence.
      BODY: I'm not dead!
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://www.ICCF.nl ///
    • Show all 2 messages in this topic