The main thing to understand is that it isn't really a true tree.
What it does is allow you to add in new undo sequences from a given
point.

You will notice that if you press   g-  or   g+  until it stops, you
will always see all changes, in the order that you made them, not
necessarily in some order that relates to a hierarchy.



On 6/22/06, Vigil <[EMAIL PROTECTED]> wrote:
Please help me understand the new undo branches in vim 7.

As I understand it, you can make some changes to a file, undo half of them,
make a minor change, then redo the recently undone changes, in effect,
rewriting history.

Firstly, I don't understand g-. I know it is meant to take you back to the
previous text state, but from the example in undo.txt, pressing g- three times
ends in " two three", even though the third last text state was "one two three"
- 'You are now back in the first undo branch, after deleting "one".'. Well, as
I remember it, the last thing I did before pressing g- for the first time was
bring back that "one" into existance, so I would be expecting to be back at the
state I was in before pressing the first g-, which would be "one two three", so
why has g- pretended I didn't do that?

Secondly, in section 32.2, and the first use of g-. Immediately beforehand, I
changed "one two" to "not two". I'm told to press g- and I'm expecting to see
the last state my text was in, which to me ought to be "one two", but instead
it has jumped to another branch and shows "me too".

It seems that subsequent presses of g- jump back and forth from one branch to
the other.

So, I open a 10-line file that just has "e" on each line. I go to the first
line and "r0", "r1" on the second line, etc. so that the file looks like line
numbers beginning at zero. If I want to undo five of the last changes, change
line six from "e" to "d", then redo those undone changes, how to?

I guess I just need a way to visualise how undo branches work. I couldn't find
any other tutorials on this. I guess it's either too new or nobody else
understands it :)

--

.

Reply via email to