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

Re: undelete

Expand Messages
  • Bram Moolenaar
    ... After testing this for a while and making sure that CTRL-G u is a good choice for the command this will be added. -- MONK: ... and the Lord spake,
    Message 1 of 12 , Oct 30, 2003
      Alan Schmitt wrote:

      > > > Is it possible to manually add "undo barriers". For instance, using
      > > > VimLaTeX, I sometimes find myself in the situation where some IMAP was
      > > > triggered and I want to remove it, but I cannot since it also undoes
      > > > what I typed before. If one could tell to vim that when some function is
      > > > triggered, it should consider the current change done, it would be
      > > > great.
      > >
      > > Currently you need to leave Insert mode for a moment or use a cursor
      > > key. But this can have side effects.
      > >
      > > This came up before. A possible solution is adding a command "CTRL-G u"
      > > that breaks undo. Try this patch:
      > [...]
      >
      > This is great. Are you planning of committing this patch (it seems to be
      > part of 140) ?

      After testing this for a while and making sure that "CTRL-G u" is a good
      choice for the command this will be added.

      --
      MONK: ... and the Lord spake, saying, "First shalt thou take out the Holy Pin,
      then shalt thou count to three, no more, no less. Three shalt be the
      number thou shalt count, and the number of the counting shalt be three.
      Four shalt thou not count, neither count thou two, excepting that thou
      then proceed to three. Five is right out. Once the number three, being
      the third number, be reached, then lobbest thou thy Holy Hand Grenade of
      Antioch towards thou foe, who being naughty in my sight, shall snuff it.
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// 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 here: http://ICCF-Holland.org/click1.html ///
    • Hari Krishna Dara
      ... Take a look at the sql_iabbr.vim on vim.sf.net for a way to undo the last undue expansion. It is not sophisticated, but works fine for the kind of
      Message 2 of 12 , Oct 30, 2003
        On Thu, 30 Oct 2003 at 7:52am, Alan Schmitt wrote:

        > * Gary Johnson (garyjohn@...) wrote:
        > >
        > > The vim manual says that 'u' undoes one change. A single change is
        > > the result of a single editing operation or editing command. The
        > > size or scope of a change depends on neither the number of lines nor
        > > the time.
        > >
        > > When you wrote those first three lines, you presumably started with
        > > an 'a' or 'i' command, typed the text, then typed <Esc> to end the
        > > operation. That was one change.
        > >
        > > When you were composing that mail, again you presumably started
        > > editing with 'a' or 'i', typed part of the text, then pasted from
        > > your cut buffer or clipboard, then realized the formatting problem
        > > and typed <Esc>. That was all one change. Therefore, typing 'u'
        > > undid everything you typed or pasted after entering insert mode.
        > >
        > > I hope that's clear. If it's any consolation, I encounter that last
        > > problem often myself, so I try to remember to type <Esc> and 'a'
        > > before pasting large chunks of text, just in case.
        >
        > Is it possible to manually add "undo barriers". For instance, using
        > VimLaTeX, I sometimes find myself in the situation where some IMAP was
        > triggered and I want to remove it, but I cannot since it also undoes
        > what I typed before. If one could tell to vim that when some function is
        > triggered, it should consider the current change done, it would be
        > great.
        >
        > Alan Schmitt

        Take a look at the sql_iabbr.vim on vim.sf.net for a way to undo the
        last undue expansion. It is not sophisticated, but works fine for the
        kind of abbreviations it defines. You may be able apply this to latex
        macros, however if the macros expand to more than a single word, you
        will have to resort to more sophisticated approach (by saving the latest
        expansion also in a variable and by using getline('.'), setline('.') and
        substitute() to do the actual revert could work).

        HTH,
        Hari

        __________________________________
        Do you Yahoo!?
        Exclusive Video Premiere - Britney Spears
        http://launch.yahoo.com/promos/britneyspears/
      • John Aldridge
        Hey!!! This works nice. inoremap inoremap inoremap inoremap
        Message 3 of 12 , Oct 31, 2003
          Hey!!! This works nice.

          inoremap <Space> <Space><Left><Right>
          inoremap <CR> <CR><Up><Down>
          inoremap <Tab> <Tab><Left><Right>
          inoremap <BS> <Left><Right><BS>

          Undo is neatly broken for spaces, new-lines, and tabs.
          The backspace is a little odd, but its still and improvement.

          If anyone has any improvements, I'd like to hear about it.

          I look forward to the feature that Bram is adding.

          Thanks
        • Andrei A. Voropaev
          ... Out of curiosity. What are those side effects? I was using it before as Ctrl-[ a and did hit anything :) What should I watch out for? Andrei
          Message 4 of 12 , Nov 4, 2003
            On Thu, Oct 30, 2003 at 03:32:21PM +0100, Bram Moolenaar wrote:
            >
            > Alan Schmitt wrote:
            >
            > > Is it possible to manually add "undo barriers". For instance, using
            > > VimLaTeX, I sometimes find myself in the situation where some IMAP was
            > > triggered and I want to remove it, but I cannot since it also undoes
            > > what I typed before. If one could tell to vim that when some function is
            > > triggered, it should consider the current change done, it would be
            > > great.
            >
            > Currently you need to leave Insert mode for a moment or use a cursor
            > key. But this can have side effects.

            Out of curiosity. What are those side effects? I was using it before as
            Ctrl-[ a and did hit anything :) What should I watch out for?

            Andrei
          • Bram Moolenaar
            ... Repeating the insert is also stopped and restarted, thus redo with . doesn t work. The solution that I submitted for tryout breaks the undo but not the
            Message 5 of 12 , Nov 4, 2003
              Andrei Voropaev wrote:

              > > > Is it possible to manually add "undo barriers". For instance, using
              > > > VimLaTeX, I sometimes find myself in the situation where some IMAP was
              > > > triggered and I want to remove it, but I cannot since it also undoes
              > > > what I typed before. If one could tell to vim that when some function is
              > > > triggered, it should consider the current change done, it would be
              > > > great.
              > >
              > > Currently you need to leave Insert mode for a moment or use a cursor
              > > key. But this can have side effects.
              >
              > Out of curiosity. What are those side effects? I was using it before as
              > Ctrl-[ a and did hit anything :) What should I watch out for?

              Repeating the insert is also stopped and restarted, thus redo with "."
              doesn't work. The solution that I submitted for tryout breaks the undo
              but not the redo. Thus you can backspace and undo the backspacing, but
              redo will insert the text with the effect of backspacing included. You
              can't have both at the same time though, since undo breaks redo. (now
              read that three times, hopefully you'll get it :-).

              --
              Communication is one of the most compli..., eh, well, it's hard.
              You know what I mean. Not?

              /// 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 here: http://ICCF-Holland.org/click1.html ///
            Your message has been successfully submitted and would be delivered to recipients shortly.