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

Using as a leader key breaks 'Does not trigger the InsertLeave autocommand event'

Expand Messages
  • Mikey
    Using as a leader key breaks Does not trigger the InsertLeave autocommand event I use GVim 7.3.600. Steps to reproduce: gvim -u NONE -U NONE set
    Message 1 of 7 , Jul 31, 2012
    • 0 Attachment
      Using <C-c> as a leader key breaks 'Does not trigger the InsertLeave
      autocommand event'

      I use GVim 7.3.600.
      Steps to reproduce:

      gvim -u NONE -U NONE
      set nocompatible
      au InsertLeave * :echo "InsertLeave event triggered"
      nnoremap <C-c>a k

      Now enter some text and while being in insert mode press <C-c> to exit
      to normal mode.

      --
      You received this message from the "vim_dev" 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
    • Lech Lorens
      ... From :help InsertLeave : *InsertLeave* InsertLeave When leaving Insert mode. Also when using CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|. Cheers, Lech
      Message 2 of 7 , Jul 31, 2012
      • 0 Attachment
        On 31 July 2012 21:36, Mikey <smieciarski@...> wrote:
        > Using <C-c> as a leader key breaks 'Does not trigger the InsertLeave
        > autocommand event'
        >
        > I use GVim 7.3.600.
        > Steps to reproduce:
        >
        > gvim -u NONE -U NONE
        > set nocompatible
        > au InsertLeave * :echo "InsertLeave event triggered"
        > nnoremap <C-c>a k
        >
        > Now enter some text and while being in insert mode press <C-c> to exit
        > to normal mode.

        From ":help InsertLeave":

        *InsertLeave*
        InsertLeave When leaving Insert mode. Also when using
        CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.

        Cheers,
        Lech

        --
        You received this message from the "vim_dev" 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
      • Kana Natsuno
        ... I ve also confirmed the problem. usually does not trigger InsertLeave as documented, but triggers InsertLeave after adding a key mapping as
        Message 3 of 7 , Jul 31, 2012
        • 0 Attachment
          On Wednesday, August 1, 2012 7:03:48 AM UTC+9, Lech Lorens wrote:
          > From ":help InsertLeave":
          >
          > *InsertLeave*
          > InsertLeave When leaving Insert mode. Also when using
          > CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.

          I've also confirmed the problem.
          <C-c> usually does not trigger InsertLeave as documented,
          but <C-c> triggers InsertLeave after adding a key mapping as Mikey described.

          --
          You received this message from the "vim_dev" 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
        • Lech Lorens
          ... Whoops, seems that I have some serious problems with reading comprehension. I misunderstood what the issue was, sorry. Cheers, Lech -- You received this
          Message 4 of 7 , Aug 1, 2012
          • 0 Attachment
            On 1 August 2012 04:38, Kana Natsuno <whileimautomaton@...> wrote:
            > On Wednesday, August 1, 2012 7:03:48 AM UTC+9, Lech Lorens wrote:
            >> From ":help InsertLeave":
            >>
            >> *InsertLeave*
            >> InsertLeave When leaving Insert mode. Also when using
            >> CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
            >
            > I've also confirmed the problem.
            > <C-c> usually does not trigger InsertLeave as documented,
            > but <C-c> triggers InsertLeave after adding a key mapping as Mikey described.

            Whoops, seems that I have some serious problems with reading
            comprehension. I misunderstood what the issue was, sorry.

            Cheers,
            Lech

            --
            You received this message from the "vim_dev" 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
          • Yasuhiro MATSUMOTO
            Sorry for top post. And sorry, I m talking about this without making sure the behavour. I wonder why you are trying to get InsertLeave with nnoremap. I beleave
            Message 5 of 7 , Aug 1, 2012
            • 0 Attachment
              Sorry for top post. And sorry, I'm talking about this without making
              sure the behavour.
              I wonder why you are trying to get InsertLeave with nnoremap. I
              beleave that leader <c-c> afect to insert mode at the first. So I'm
              thinking it should be inoremap to do that.


              On 8/1/12, Mikey <smieciarski@...> wrote:
              > Using <C-c> as a leader key breaks 'Does not trigger the InsertLeave
              > autocommand event'
              >
              > I use GVim 7.3.600.
              > Steps to reproduce:
              >
              > gvim -u NONE -U NONE
              > set nocompatible
              > au InsertLeave * :echo "InsertLeave event triggered"
              > nnoremap <C-c>a k
              >
              > Now enter some text and while being in insert mode press <C-c> to exit
              > to normal mode.
              >
              > --
              > You received this message from the "vim_dev" 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
              >


              --
              - Yasuhiro Matsumoto

              --
              You received this message from the "vim_dev" 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
            • Ben Fritz
              ... I think the problem is that the OP DOESN T want the InsertLeave autocmd to fire, so he uses to exit insert mode. The docs say should exit
              Message 6 of 7 , Aug 1, 2012
              • 0 Attachment
                On Wednesday, August 1, 2012 10:25:57 AM UTC-5, mattn wrote:
                > Sorry for top post. And sorry, I'm talking about this without making
                >
                > sure the behavour.
                >
                > I wonder why you are trying to get InsertLeave with nnoremap. I
                >
                > beleave that leader <c-c> afect to insert mode at the first. So I'm
                >
                > thinking it should be inoremap to do that.
                >
                >

                I think the problem is that the OP DOESN'T want the InsertLeave autocmd to fire, so he uses <C-C> to exit insert mode. The docs say <C-C> should exit insert mode without firing the autocmd. If I understand correctly, with <C-C> as part of the LHS of a *normal mode* mapping, exiting Insert mode with <C-C> DOES trigger the autocmd.

                I also confirm this behavior. I would expect that a <C-C> mapping in normal mode has no effect on behavior of insert mode, but in this case, it does.

                --
                You received this message from the "vim_dev" 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
              • Mikey
                ... That s exactly what I meant. -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to.
                Message 7 of 7 , Aug 1, 2012
                • 0 Attachment
                  On Aug 1, 5:37 pm, Ben Fritz <fritzophre...@...> wrote:
                  > I think the problem is that the OP DOESN'T want the InsertLeave autocmd to fire, so he uses <C-C> to exit insert mode. The docs say <C-C> should exit insert mode without firing the autocmd. If I understand correctly, with <C-C> as part of the LHS of a *normal mode* mapping, exiting Insert mode with <C-C> DOES trigger the autocmd.

                  That's exactly what I meant.

                  --
                  You received this message from the "vim_dev" 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.