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

72028Re: Breaking undo in Insert mode

Expand Messages
  • Ben Fritz
    Jul 9, 2013
    • 0 Attachment
      On Tuesday, July 9, 2013 10:13:22 AM UTC-5, Bram Moolenaar wrote:
      > Ben Fritz wrote:
      >
      > > I don't remember how setline() solves the problem, but just returning
      >
      > > cursor sequences doesn't work, because it breaks undo/redo/repeat.
      >
      >
      >
      > Yeah, that's true. I suppose we could avoid saving for undo under
      >
      > certain conditions, but it's quite hard to decide what those conditions
      >
      > are. Perhaps "when inserting a register and the cursor remains within
      >
      > the inserted text"?
      >

      Is that easier than an explicit "normally the next movement would break the undo sequence but I don't want it to" keystroke or command? Something like the inverse of i_CTRL-G_u. Then you could simply do something like:

      inoremap ( ()<C-G>U<Left>
      inoremap <expr> ) (NextChar()==')' ? "\<C-G>U\<Right>" : ")")

      Really I don't care HOW it's accomplished as long as it is possible to move the cursor in insert mode one or two characters without breaking undo. If allowing limited cursor movement when inserting a register is easy enough, I can probably work with 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/groups/opt_out.
    • Show all 18 messages in this topic