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

Re: Wish: Vim remembered my previous changes (so that I could und o them)

Expand Messages
  • Andrew Pimlott
    ... I m actually quite familiar with the undo data structures (from writing a global undo feature). Since a few people seem at least mildly interested in
    Message 1 of 5 , May 30, 2003
      On Fri, May 30, 2003 at 09:27:37AM +0100, Vince Negri wrote:
      > Take a look at undo.c; the undo information for
      > each buffer is a doubly-linked list of linked
      > lists. If you created a means to dump that
      > data to disk and later reload it, not only could
      > you load a file and start undoing, you could
      > also load a file and start *redoing* changes you
      > undid prior to saving the file.

      I'm actually quite familiar with the undo data structures (from
      writing a global undo feature). Since a few people seem at least
      mildly interested in this, maybe I'll give it a go.

      Andrew
    • Bram Moolenaar
      ... I m interested as well. The implementation is one thing (esp. checking that the original file didn t change, otherwise you end up with garbage). The user
      Message 2 of 5 , May 30, 2003
        Andrew Pimlott wrote:

        > On Fri, May 30, 2003 at 09:27:37AM +0100, Vince Negri wrote:
        > > Take a look at undo.c; the undo information for
        > > each buffer is a doubly-linked list of linked
        > > lists. If you created a means to dump that
        > > data to disk and later reload it, not only could
        > > you load a file and start undoing, you could
        > > also load a file and start *redoing* changes you
        > > undid prior to saving the file.
        >
        > I'm actually quite familiar with the undo data structures (from
        > writing a global undo feature). Since a few people seem at least
        > mildly interested in this, maybe I'll give it a go.

        I'm interested as well. The implementation is one thing (esp. checking
        that the original file didn't change, otherwise you end up with
        garbage). The user interface is another. There probably should be
        command to undo/redo up to a point where the file was saved. Or "undo
        for 10 days"... And "delete undo info older than a week"...

        When so much undo info is stored you also run into a related request:
        remember multiple change branches. Storing the info isn't difficult at
        all (just a few extra pointers). The big question is how the user could
        navigate through the branches. Try thinking of a nice solution for
        that!

        --
        Due knot trussed yore spell chequer two fined awl miss steaks.

        /// 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 ///
      • Andrew Pimlott
        ... What do you mean by this one? The first way I read this is unrelated to saving the undo buffer: you save, you edit, and you hit a key to take you back
        Message 3 of 5 , May 30, 2003
          On Fri, May 30, 2003 at 11:39:30PM +0200, Bram Moolenaar wrote:
          > I'm interested as well. The implementation is one thing (esp. checking
          > that the original file didn't change, otherwise you end up with
          > garbage). The user interface is another. There probably should be
          > command to undo/redo up to a point where the file was saved.

          What do you mean by this one? The first way I read this is
          unrelated to saving the undo buffer: you save, you edit, and you hit
          a key to take you back through the undo list to the point of the
          save. Actually, I would like this feature. I would also like a key
          to go to the ends of the undo buffer--I often do 1000u to get back
          to where I started--then look around _very carefully_[1] so I don't
          accidentally edit anything--then 1000^R. Now that I think about it,
          a way to set marks in the undo list would be nice ...

          > Or "undo
          > for 10 days"... And "delete undo info older than a week"...

          I would love it.

          > remember multiple change branches. Storing the info isn't difficult at
          > all (just a few extra pointers). The big question is how the user could
          > navigate through the branches. Try thinking of a nice solution for
          > that!

          I remember this from the vim 6 idea vote, and I've always thought it
          would be cool--but I also didn't have any clue about the interface.
          However, writing this message gives me an idea: What about marks in
          the undo list--er, tree? So I make some changes, have second
          thoughts, set an undo mark, undo my way back to a starting point,
          and make some more changes. If I jump to the undo mark, I get back
          to my first changes, and can undo and redo just as before. Ie, u
          and ^R always work linearly, but I can switch between streams. This
          also controls the memory usage: if you abandon a branch without
          setting any marks, vim can throw it away.

          Wow, I really like this idea. I'm beginning to think this could
          change the way I edit. (Just like 'hidden' did, by allowing me to
          keep undo lists for every file I edit in a session. Maybe I'm just
          an undo junkie.)

          Andrew

          [1] Does anyone remember the point in Zork where you must "crawl
          carefully"--not "crawl"--to get past some obstacle?
        Your message has been successfully submitted and would be delivered to recipients shortly.