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

Concatenate two performed actions into one (to make it repeatable by '.' and undoable at once)

Expand Messages
  • Dmitry Frank
    Consider a simple example: say, I just typed foo, then pressed Left key, and typed bar. Now I have fobaro. When I press . key, only bar part is repeated, and
    Message 1 of 12 , Apr 3 8:33 AM
    • 0 Attachment

      Consider a simple example: say, I just typed foo, then pressed Left key, and typed bar. Now I have fobaro.

      When I press . key, only bar part is repeated, and the same is with undo.

      So I want the whole fobaro to be repeated when I press ., and to be undid completely at once when I press u.

      I'm just writing plugin ( auto-pairs-gentle ) that does some tricks like that, and I want it not to break undo history.

      A couple of months ago I asked that on stackoverflow: http://stackoverflow.com/questions/20863411/vim-concatenate-two-actions-into-one-to-make-it-repeatable-by-and-undoable ,

      I know about :undojoin , but it can only solve undo problem, not repeat problem. That would be ideal if we have some command to join last two actions, that would be great help for plugins like that.

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Ben Fritz
      ... Not breaking undo or repeat on auto-pair plugins like this is something that once had ugly hacks you could do to accomplish it. Delimitmate implemented
      Message 2 of 12 , Apr 3 8:40 AM
      • 0 Attachment
        On Thursday, April 3, 2014 10:33:38 AM UTC-5, Dmitry Frank wrote:
        > Consider a simple example: say, I just typed foo, then pressed Left key, and typed bar. Now I have fobaro.
        >
        >
        > When I press . key, only bar part is repeated, and the same is with undo.
        >
        >
        >
        > So I want the whole fobaro to be repeated when I press ., and to be undid completely at once when I press u.
        >
        >
        > I'm just writing plugin ( auto-pairs-gentle ) that does some tricks like that, and I want it not to break undo history.
        > A couple of months ago I asked that on stackoverflow: http://stackoverflow.com/questions/20863411/vim-concatenate-two-actions-into-one-to-make-it-repeatable-by-and-undoable ,
        >
        >
        >
        > I know about :undojoin , but it can only solve undo problem, not repeat problem. That would be ideal if we have some command to join last two actions, that would be great help for plugins like that.

        Not breaking undo or repeat on auto-pair plugins like this is something that once had ugly hacks you could do to accomplish it. Delimitmate implemented these. But sometime right before 7.4 was released, a bug was fixed which made all those hacks not work anymore. I think they relied on setline() not breaking the undo sequence or something.

        I would really like to see an insert-mode command that would be like the inverse of <C-G>u which currently breaks the undo sequence manually. The new command would suppress breaking the undo sequence for the next command, so you could do something like ifunc()<C-G>U<Left>arg<Esc> to get a single change for undo/redo/repeat rather than 2 separate changes and a broken repeat.

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Christian Brabandt
        ... Not possible currently, I am afraid. IIRC using the cursor keys always breaks redo. Best, Christian -- Wußten Sie schon... ... daß man Flutlicht auch bei
        Message 3 of 12 , Apr 4 5:04 AM
        • 0 Attachment
          On Do, 03 Apr 2014, Dmitry Frank wrote:

          > Consider a simple example: say, I just typed foo, then pressed Left key,
          > and typed bar. Now I have fobaro.
          >
          > When I press . key, only bar part is repeated, and the same is with undo.
          >
          > So I want the whole fobaro to be repeated when I press ., and to be undid
          > completely at once when I press u.
          >
          > I'm just writing plugin ( auto-pairs-gentle <http://goo.gl/VyOZ0r> ) that
          > does some tricks like that, and I want it not to break undo history.
          >
          > A couple of months ago I asked that on stackoverflow:
          > http://stackoverflow.com/questions/20863411/vim-concatenate-two-actions-into-one-to-make-it-repeatable-by-and-undoable,

          Not possible currently, I am afraid. IIRC using the cursor keys always
          breaks redo.

          Best,
          Christian
          --
          Wußten Sie schon...
          ... daß man Flutlicht auch bei Ebbe einschalten darf?

          --
          --
          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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Dmitry Frank
          ... That s true, so I just want to make feature-request: it would really be good if vimscript has tools for concatenating two (or more) actions into one, to
          Message 4 of 12 , Apr 4 7:29 AM
          • 0 Attachment



            2014-04-04 16:04 GMT+04:00 Christian Brabandt <cblists@...>:
            On Do, 03 Apr 2014, Dmitry Frank wrote:

            > Consider a simple example: say, I just typed foo, then pressed Left key,
            > and typed bar. Now I have fobaro.
            >
            > When I press . key, only bar part is repeated, and the same is with undo.
            >
            > So I want the whole fobaro to be repeated when I press ., and to be undid
            > completely at once when I press u.
            >
            > I'm just writing plugin ( auto-pairs-gentle <http://goo.gl/VyOZ0r> ) that
            > does some tricks like that, and I want it not to break undo history.
            >
            > A couple of months ago I asked that on stackoverflow:
            > http://stackoverflow.com/questions/20863411/vim-concatenate-two-actions-into-one-to-make-it-repeatable-by-and-undoable,

            Not possible currently, I am afraid. IIRC using the cursor keys always
            breaks redo.


            That's true, so I just want to make feature-request: it would really be good if vimscript has tools for concatenating two (or more) actions into one, to make them repeatable and undoable at once. Do you agree?
             

            --
            --
            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

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Bram Moolenaar
            ... You can record into a register and replay that. -- What a wonderfully exciting cough! Do you mind if I join you? -- Douglas Adams, The Hitchhiker s Guide
            Message 5 of 12 , Apr 5 12:02 PM
            • 0 Attachment
              Dmitry Frank wrote:

              > 2014-04-04 16:04 GMT+04:00 Christian Brabandt <cblists@...>:
              >
              > > On Do, 03 Apr 2014, Dmitry Frank wrote:
              > >
              > > > Consider a simple example: say, I just typed foo, then pressed Left key,
              > > > and typed bar. Now I have fobaro.
              > > >
              > > > When I press . key, only bar part is repeated, and the same is with undo.
              > > >
              > > > So I want the whole fobaro to be repeated when I press ., and to be undid
              > > > completely at once when I press u.
              > > >
              > > > I'm just writing plugin ( auto-pairs-gentle <http://goo.gl/VyOZ0r> )
              > > that
              > > > does some tricks like that, and I want it not to break undo history.
              > > >
              > > > A couple of months ago I asked that on stackoverflow:
              > > >
              > > http://stackoverflow.com/questions/20863411/vim-concatenate-two-actions-into-one-to-make-it-repeatable-by-and-undoable
              > > ,
              > >
              > > Not possible currently, I am afraid. IIRC using the cursor keys always
              > > breaks redo.
              >
              > That's true, so I just want to make feature-request: it would really be
              > good if vimscript has tools for concatenating two (or more) actions into
              > one, to make them repeatable and undoable at once. Do you agree?

              You can record into a register and replay that.


              --
              What a wonderfully exciting cough! Do you mind if I join you?
              -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

              --
              --
              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

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Ben Fritz
              ... This is not an option for the desired use case, of creating a plugin to automatically insert closing parentheses and the like as you type the opening
              Message 6 of 12 , Apr 5 1:32 PM
              • 0 Attachment
                On Saturday, April 5, 2014 2:02:23 PM UTC-5, Bram Moolenaar wrote:
                >
                > You can record into a register and replay that.
                >

                This is not an option for the desired use case, of creating a plugin to automatically insert closing parentheses and the like as you type the opening character. For that we need to be able to move the cursor in insert mode without breaking undo and without knowing in advance that we need to be recording a macro. One cannot start recording a macro with a mapping, 'q' does not function in a mapping according to the help. So the user would manually need to start recording before typing every single time, so mapping every insert-mode entry key would not only be annoying, it wouldn't work. Plus, one would want a plugin such as this to be itself recordable in a macro, which can't be done if you must record a macro to accomplish the task.

                --
                --
                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

                ---
                You received this message because you are subscribed to the Google Groups "vim_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • Bram Moolenaar
                ... I have no clue how you could repeat the changes a plugin makes with . . The plugin could do anything, with any kind of advanced logic. How would . know
                Message 7 of 12 , Apr 5 2:09 PM
                • 0 Attachment
                  Ben Fritz wrote:

                  > On Saturday, April 5, 2014 2:02:23 PM UTC-5, Bram Moolenaar wrote:
                  > >
                  > > You can record into a register and replay that.
                  > >
                  >
                  > This is not an option for the desired use case, of creating a plugin
                  > to automatically insert closing parentheses and the like as you type
                  > the opening character. For that we need to be able to move the cursor
                  > in insert mode without breaking undo and without knowing in advance
                  > that we need to be recording a macro. One cannot start recording a
                  > macro with a mapping, 'q' does not function in a mapping according to
                  > the help. So the user would manually need to start recording before
                  > typing every single time, so mapping every insert-mode entry key would
                  > not only be annoying, it wouldn't work. Plus, one would want a plugin
                  > such as this to be itself recordable in a macro, which can't be done
                  > if you must record a macro to accomplish the task.

                  I have no clue how you could repeat the changes a plugin makes with ".".
                  The plugin could do anything, with any kind of advanced logic. How
                  would "." know what to repeat? It can't possibly know that you inserted
                  ")" in a specific place and repeat that.


                  --
                  hundred-and-one symptoms of being an internet addict:
                  31. You code your homework in HTML and give your instructor the URL.

                  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                  \\\ an exciting new programming language -- http://www.Zimbu.org ///
                  \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                  --
                  --
                  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

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_dev" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                • Benjamin Fritz
                  ... Well at least we could join the undo sequence so u/ work properly afterward. Potentially repeat.vim can help here. I know that by abusing setline() in
                  Message 8 of 12 , Apr 5 2:17 PM
                  • 0 Attachment
                    On Sat, Apr 5, 2014 at 4:09 PM, Bram Moolenaar <Bram@...> wrote:
                    >
                    > Ben Fritz wrote:
                    >
                    >> On Saturday, April 5, 2014 2:02:23 PM UTC-5, Bram Moolenaar wrote:
                    >> >
                    >> > You can record into a register and replay that.
                    >> >
                    >>
                    >> This is not an option for the desired use case, of creating a plugin
                    >> to automatically insert closing parentheses and the like as you type
                    >> the opening character. For that we need to be able to move the cursor
                    >> in insert mode without breaking undo and without knowing in advance
                    >> that we need to be recording a macro. One cannot start recording a
                    >> macro with a mapping, 'q' does not function in a mapping according to
                    >> the help. So the user would manually need to start recording before
                    >> typing every single time, so mapping every insert-mode entry key would
                    >> not only be annoying, it wouldn't work. Plus, one would want a plugin
                    >> such as this to be itself recordable in a macro, which can't be done
                    >> if you must record a macro to accomplish the task.
                    >
                    > I have no clue how you could repeat the changes a plugin makes with ".".
                    > The plugin could do anything, with any kind of advanced logic. How
                    > would "." know what to repeat? It can't possibly know that you inserted
                    > ")" in a specific place and repeat that.
                    >

                    Well at least we could join the undo sequence so u/<C-R> work properly
                    afterward. Potentially repeat.vim can help here.

                    I know that by abusing setline() in previous versions of Vim,
                    delimitMate and other plugins managed to get this working.

                    But now nobody seems to have found a working hack.

                    It would be better to support it intentionally. For example, with an
                    insert-mode command to chain two changes together.

                    :undojoin works for arbitrary ex commands. Why can't we have something
                    similar for insert mode segments?

                    --
                    --
                    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

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_dev" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                    For more options, visit https://groups.google.com/d/optout.
                  • Justin M. Keyes
                    ... I found a working hack[1] (except it doesn t work for visual-block mode :) Speaking of which, does anyone know how to detect visual-block mode? There was a
                    Message 9 of 12 , Apr 5 3:50 PM
                    • 0 Attachment
                      On Sat, Apr 5, 2014 at 5:17 PM, Benjamin Fritz <fritzophrenic@...> wrote:
                      > On Sat, Apr 5, 2014 at 4:09 PM, Bram Moolenaar <Bram@...> wrote:
                      >>
                      >> Ben Fritz wrote:
                      >>
                      >>> On Saturday, April 5, 2014 2:02:23 PM UTC-5, Bram Moolenaar wrote:
                      >>> >
                      >>> > You can record into a register and replay that.
                      >>> >
                      >>>
                      >>> This is not an option for the desired use case, of creating a plugin
                      >>> to automatically insert closing parentheses and the like as you type
                      >>> the opening character. For that we need to be able to move the cursor
                      >>> in insert mode without breaking undo and without knowing in advance
                      >>> that we need to be recording a macro. One cannot start recording a
                      >>> macro with a mapping, 'q' does not function in a mapping according to
                      >>> the help. So the user would manually need to start recording before
                      >>> typing every single time, so mapping every insert-mode entry key would
                      >>> not only be annoying, it wouldn't work. Plus, one would want a plugin
                      >>> such as this to be itself recordable in a macro, which can't be done
                      >>> if you must record a macro to accomplish the task.
                      >>
                      >> I have no clue how you could repeat the changes a plugin makes with ".".
                      >> The plugin could do anything, with any kind of advanced logic. How
                      >> would "." know what to repeat? It can't possibly know that you inserted
                      >> ")" in a specific place and repeat that.
                      >>
                      >
                      > Well at least we could join the undo sequence so u/<C-R> work properly
                      > afterward. Potentially repeat.vim can help here.
                      >
                      > I know that by abusing setline() in previous versions of Vim,
                      > delimitMate and other plugins managed to get this working.
                      >
                      > But now nobody seems to have found a working hack.

                      I found a working hack[1] (except it doesn't work for visual-block mode :)

                      Speaking of which, does anyone know how to detect visual-block mode?
                      There was a suggestion[2] to call visualmode(1) in an autocmd:

                      autocmd InsertLeave * call visualmode(1)

                      ...and then check for mode() == 'i' && visualmode() == '^V'. But that
                      could have side-effects for other plugins or the user's mappings.

                      [1] https://github.com/Raimondi/delimitMate/issues/138#issuecomment-35458273
                      [2] https://github.com/Raimondi/delimitMate/issues/138#issuecomment-35588257

                      > It would be better to support it intentionally. For example, with an
                      > insert-mode command to chain two changes together.
                      >
                      > :undojoin works for arbitrary ex commands. Why can't we have something
                      > similar for insert mode segments?

                      It was discussed some time ago on either vim_use or vim_dev, but I
                      can't find the thread.

                      Justin M. Keyes

                      --
                      --
                      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

                      ---
                      You received this message because you are subscribed to the Google Groups "vim_dev" group.
                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                      For more options, visit https://groups.google.com/d/optout.
                    • Andrew
                      Rather than joining several actions, a different approach might be to allow the repeat register to be set explicitly, as if it were a macro. Being able to read
                      Message 10 of 12 , Apr 6 4:05 AM
                      • 0 Attachment
                        Rather than joining several actions, a different approach might be to allow the repeat register to be set explicitly, as if it were a macro.

                        Being able to read it would already be somewhat useful. See this reddit thread: http://www.reddit.com/r/vim/comments/1u5k0c/saving_the_last_normal_mode_command_so_command_to/. Arguably, it'd be a small benefit, but it's quite easy to do (I've been meaning to propose a patch for a while now).

                        Being able to overwrite the `redobuff` would be even more useful, though, essentially replacing the entire repeat.vim plugin with:

                        let @<redo-register> = "..."

                        Right now, repeat.vim does a lot of tricks to work correctly and complicated usage of it can fail.

                        I'm not sure how much easier it would make this particular use case, but maybe it's some starting point. It's somewhat similar to the "start a macro" advice, except there's no explicit macro, instead we store a more complicated movement as the "last action".

                        For instance, it could be that pressing the "Left" key could store the current state of the redo buffer and cursor position in a variable, and register an autocommand for leaving insert mode when it stores the real "action to repeat". It might still turn out to be impossible or at least very complicated. Can't say without trying it out, maybe Dmitry can give his thoughts on this.

                        --
                        --
                        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

                        ---
                        You received this message because you are subscribed to the Google Groups "vim_dev" group.
                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                        For more options, visit https://groups.google.com/d/optout.
                      • Bram Moolenaar
                        ... Implementing joining undo is possible. But often users ask for breaking up insert into smaller undo-able pieces. That s why we have CTRL-G u. ... The
                        Message 11 of 12 , Apr 6 4:42 AM
                        • 0 Attachment
                          Ben Fritz wrote:

                          > >> On Saturday, April 5, 2014 2:02:23 PM UTC-5, Bram Moolenaar wrote:
                          > >> >
                          > >> > You can record into a register and replay that.
                          > >> >
                          > >>
                          > >> This is not an option for the desired use case, of creating a plugin
                          > >> to automatically insert closing parentheses and the like as you type
                          > >> the opening character. For that we need to be able to move the cursor
                          > >> in insert mode without breaking undo and without knowing in advance
                          > >> that we need to be recording a macro. One cannot start recording a
                          > >> macro with a mapping, 'q' does not function in a mapping according to
                          > >> the help. So the user would manually need to start recording before
                          > >> typing every single time, so mapping every insert-mode entry key would
                          > >> not only be annoying, it wouldn't work. Plus, one would want a plugin
                          > >> such as this to be itself recordable in a macro, which can't be done
                          > >> if you must record a macro to accomplish the task.
                          > >
                          > > I have no clue how you could repeat the changes a plugin makes with ".".
                          > > The plugin could do anything, with any kind of advanced logic. How
                          > > would "." know what to repeat? It can't possibly know that you inserted
                          > > ")" in a specific place and repeat that.
                          > >
                          >
                          > Well at least we could join the undo sequence so u/<C-R> work properly
                          > afterward. Potentially repeat.vim can help here.

                          Implementing joining undo is possible. But often users ask for breaking
                          up insert into smaller undo-able pieces. That's why we have CTRL-G u.

                          > I know that by abusing setline() in previous versions of Vim,
                          > delimitMate and other plugins managed to get this working.
                          >
                          > But now nobody seems to have found a working hack.
                          >
                          > It would be better to support it intentionally. For example, with an
                          > insert-mode command to chain two changes together.

                          The problem is that there will not be a standard way how to apply those
                          two changes. If it's just two inserts after another it would be
                          possible, but in general the cursor would have moved somewhere else and
                          perhaps indent depends on the indent of another line.

                          Most likely the solution lies in repeating what the plugin does by
                          invoking the plugin again. Instead of trying to record and replay what
                          the plugin ended up doing. So the redo buffer would contain whatever
                          triggered the plugin, and redo would trigger the plugin again.

                          How do these kind of plugins get triggered anyway? Insert mode mapping?
                          Would be good to start with a relevant example.

                          > :undojoin works for arbitrary ex commands. Why can't we have something
                          > similar for insert mode segments?

                          --
                          hundred-and-one symptoms of being an internet addict:
                          32. You don't know what sex three of your closest friends are, because they
                          have neutral nicknames and you never bothered to ask.

                          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                          \\\ an exciting new programming language -- http://www.Zimbu.org ///
                          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                          --
                          --
                          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

                          ---
                          You received this message because you are subscribed to the Google Groups "vim_dev" group.
                          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                          For more options, visit https://groups.google.com/d/optout.
                        • Dmitry Frank
                          ... Actually, vim already supports complicated undo/redo: say, if file was changed externally, Vim asks if it should reload it. If user answers yes , vim
                          Message 12 of 12 , Apr 9 2:07 AM
                          • 0 Attachment



                            2014-04-06 23:09 GMT+04:00 Bram Moolenaar <Bram@...>:

                            Ben Fritz wrote:

                            > On Sunday, April 6, 2014 6:42:35 AM UTC-5, Bram Moolenaar wrote:
                            >
                            > > The problem is that there will not be a standard way how to apply those
                            > > two changes.  If it's just two inserts after another it would be
                            > > possible, but in general the cursor would have moved somewhere else and
                            > > perhaps indent depends on the indent of another line.
                            > >
                            > > Most likely the solution lies in repeating what the plugin does by
                            > > invoking the plugin again.  Instead of trying to record and replay what
                            > > the plugin ended up doing.  So the redo buffer would contain whatever
                            > > triggered the plugin, and redo would trigger the plugin again.
                            > >
                            > > How do these kind of plugins get triggered anyway?  Insert mode mapping?
                            > > Would be good to start with a relevant example.
                            >
                            > At its heart, this kind of plugin is an insert-mode mapping, where
                            > when you press ( you get () instead, with the cursor in between.
                            >
                            > To get it to work with the '.' operator, it also needs mappings for
                            > <Esc> and some other commands so it can invoke repeat.vim.
                            >
                            > But for undo/redo, there was not any known solution last I knew. I
                            > guess Justin may have found something as he posted earlier. I haven't
                            > seen it working in practice yet, I will probably try it out later this
                            > week. The difficulty is that EVERY cursor movement in insert-mode will
                            > break the undo sequence and there is no way around it. It would be
                            > nice to have some sort of movement command within a line that would
                            > not break the undo sequence, or an explicit command to join two
                            > arbitrary edits, or a command from normal mode that would start insert
                            > mode and join the resulting insert to the last undo in the chain.

                            Adding these commands will make life more complicated.  I think the
                            solution would be to have a different kind of map, which indicates that
                            undo is not to be split, and what the map results in should not be added
                            to the redo buffer.  Instead, what triggered the map is to be added to
                            the redo buffer.  So that redo-ing it will trigger the map again.

                            This won't be easy, it probably requires adding markers in the typeahead
                            buffer and redo buffer, but it's certainly better than adding a bunch of
                            strange commands to move around without splitting undo/redo.


                            Actually, vim already supports "complicated" undo/redo: say, if file was changed externally, Vim asks if it should reload it. If user answers "yes", vim loads file, compare it with buffer contents, and all of changes are written as just single action.

                            Here, when user wants to join several actions, we need for the same, plus repeating it with a dot.

                            About repeating with a dot: repeat.vim is not an option here: it is useful when I have exact mapping to be repeated. But here I must repeat all that user typed before plugin "pressed" <Left> key, and after it too, so, I have to remap all the thousand ways of quitting insert mode, and then give to repeat.vim all that user just typed.

                             

                            --
                            --
                            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

                            ---
                            You received this message because you are subscribed to the Google Groups "vim_dev" group.
                            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                            For more options, visit https://groups.google.com/d/optout.
                          Your message has been successfully submitted and would be delivered to recipients shortly.