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

Re: Bug? Insert mode mapping with .

Expand Messages
  • Yiu Wing
    ... another ... applying ... goes ... end, ... people ... replace ... it) ... mapping. ... I forgot to mentioned it my first post that I already had set
    Message 1 of 7 , Apr 3, 2003
    • 0 Attachment
      >On Thu, 03 Apr 2003 at 00:16:29 +0200, Antoine J. Mechelynck wrote:
      >> Yiu Wing <yiuwing.yip@...> wrote:
      >>>
      >>> According to the doc for "map-<silent>", if a mapping is defined with
      >>> the <silent> option, it won't be echoed on the command line. This
      >>> works as expected for normal mode mappings, but it doesn't work for
      >>> insert mode mappings.
      >>>
      >>> The following mapping demonstrates this behaviour,
      >>>
      >>> inoremap <silent> a a<ESc>:call tempname()<cr>a
      >>>
      >>> If you type the letter 'a' repeatedly after remapping it, and with the
      >>> showmode option on, you can see the mode message "--insert--" flickers
      >>> sporadically.
      >>>
      >>> Does <silent> not apply to insert map, or it is a bug?
      >>
      >> I don't have much authority on this subject, but since I don't see
      another
      >> answer down the line, I venture one.
      >>
      >> IMHO, if you see "-- INSERT --" flickering but no trace of ":call
      >> tempname()" being shown, then it's neither a bug nor <silent> not
      applying
      >> to Insert mode, it's just normal behaviour. How do I mean? Well, <silent>
      >> suppresses the map itself being echoed, but the mapping still "does its
      >> stuff". In this case, part of that "stuff" consists of leaving insertmode
      >> temporarily to call the "tempname()" function. Whenever the mapping goes
      >> from Insert mode to Normal mode, "-- INSERT --" disappears. Whenever it
      goes
      >> back to Insert mode through the normal-mode "a" (append) command at the
      end,
      >> "-- INSERT --" reappears. I wouldn't call that a bug. But then, other
      people
      >> might be more enlightened than me on this subject.
      >>
      >> I think that, in order to avoid "-- INSERT --" flickering you could
      replace
      >> the mapping by
      >>
      >> :inoremap a a<C-O>:call tempname()<CR>
      >>
      >> (see :help i_CTRL-O). But then it might (or might not, I haven't tested
      it)
      >> be temporarily replaced by "-- (insert) --" during execution of the
      mapping.
      >
      >You might also want to look at the 'lazyredraw' option.

      I forgot to mentioned it my first post that I already had set 'lazyredraw'
      option.

      Regards,

      Yiu Wing

      >--
      >Piet Delport
      >Today's subliminal thought is:
    • Bram Moolenaar
      ... Using means the mapped characters are not echoed. The current mode is still updated though. You could disable showmode for a moment, but doing
      Message 2 of 7 , Apr 3, 2003
      • 0 Attachment
        Yiu Wing wrote:

        > According to the doc for "map-<silent>", if a mapping is defined with the
        > <silent> option, it won't be echoed on the command line. This works as
        > expected for normal mode mappings, but it doesn't work for insert mode
        > mappings.
        >
        > The following mapping demonstrates this behaviour,
        >
        > inoremap <silent> a a<ESc>:call tempname()<cr>a
        >
        > If you type the letter 'a' repeatedly after remapping it, and with the
        > showmode option on, you can see the mode message "--insert--" flickers
        > sporadically.
        >
        > Does <silent> not apply to insert map, or it is a bug?

        Using <silent> means the mapped characters are not echoed. The current
        mode is still updated though. You could disable 'showmode' for a
        moment, but doing that might already cause a bit of flicker.

        --
        Witches prefer brooms: vacuum-cleaners need extension cords!

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
      • Yiu Wing
        ... the ... Glad to know this is an expected behaviour. I had tried disable showmode for a moment and then turned it on immediately at the end of the
        Message 3 of 7 , Apr 4, 2003
        • 0 Attachment
          > Yiu Wing wrote:
          >
          > > According to the doc for "map-<silent>", if a mapping is defined with
          the
          > > <silent> option, it won't be echoed on the command line. This works as
          > > expected for normal mode mappings, but it doesn't work for insert mode
          > > mappings.
          > >
          > > The following mapping demonstrates this behaviour,
          > >
          > > inoremap <silent> a a<ESc>:call tempname()<cr>a
          > >
          > > If you type the letter 'a' repeatedly after remapping it, and with the
          > > showmode option on, you can see the mode message "--insert--" flickers
          > > sporadically.
          > >
          > > Does <silent> not apply to insert map, or it is a bug?
          >
          > Using <silent> means the mapped characters are not echoed. The current
          > mode is still updated though. You could disable 'showmode' for a
          > moment, but doing that might already cause a bit of flicker.

          Glad to know this is an expected behaviour.

          I had tried disable 'showmode' for a moment and then turned it on
          immediately at the end of the mapping, but I could still see the flickers.
          Never mind, it's really no big deal. The flickers can be almost invisible,
          if I choose the right combination of background and foreground colours.

          Regards,

          Yiu Wing

          > --
          > Witches prefer brooms: vacuum-cleaners need extension cords!
          >
          > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net
          \\\
          > /// Creator of Vim - Vi IMproved -- http://www.Vim.org
          \\\
          > \\\ Project leader for A-A-P -- http://www.A-A-P.org
          ///
          > \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html
          ///
        Your message has been successfully submitted and would be delivered to recipients shortly.