annotate runtime/doc/usr_32.txt @ 1258:aa7ad2e4b67d

updated for version 7.1
author vimboss
date Sat, 12 May 2007 14:13:37 +0000
parents 8906c10ecbb0
children 57361514f73a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1213
8906c10ecbb0 updated for version 7.1b
vimboss
parents: 1121
diff changeset
1 *usr_32.txt* For Vim version 7.1b. Last change: 2006 Apr 30
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
2
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
3 VIM USER MANUAL - by Bram Moolenaar
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
4
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
5 The undo tree
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
6
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
7
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
8 Vim provides multi-level undo. If you undo a few changes and then make a new
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
9 change you create a branch in the undo tree. This text is about moving
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
10 through the branches.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
11
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
12 |32.1| Numbering changes
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
13 |32.2| Jumping around the tree
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
14 |32.3| Time travelling
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
15
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
16 Next chapter: |usr_40.txt| Make new commands
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
17 Previous chapter: |usr_31.txt| Exploiting the GUI
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
18 Table of contents: |usr_toc.txt|
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
19
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
20 ==============================================================================
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
21 *32.1* Numbering changes
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
22
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
23 In section |02.5| we only discussed one line of undo/redo. But it is also
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
24 possible to branch off. This happens when you undo a few changes and then
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
25 make a new change. The new changes become a branch in the undo tree.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
26
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
27 Let's start with the text "one". The first change to make is to append
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
28 " too". And then move to the first 'o' and change it into 'w'. We then have
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
29 two changes, numbered 1 and 2, and three states of the text:
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
30
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
31 one ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
32 |
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
33 change 1
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
34 |
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
35 one too ~
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
36 |
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
37 change 2
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
38 |
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
39 one two ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
40
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
41 If we now undo one change, back to "one too", and change "one" to "me" we
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
42 create a branch in the undo tree:
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
43
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
44 one ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
45 |
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
46 change 1
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
47 |
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
48 one too ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
49 / \
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
50 change 2 change 3
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
51 | |
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
52 one two me too ~
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
53
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
54 You can now use the |u| command to undo. If you do this twice you get to
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
55 "one". Use |CTRL-R| to redo, and you will go to "one too". One more |CTRL-R|
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
56 takes you to "me too". Thus undo and redo go up and down in the tree, using
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
57 the branch that was last used.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
58
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
59 What matters here is the order in which the changes are made. Undo and redo
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
60 are not considered changes in this context. After each change you have a new
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
61 state of the text.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
62
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
63 Note that only the changes are numbered, the text shown in the tree above has
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
64 no identifier. They are mostly referred to by the number of the change above
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
65 it. But sometimes by the number of one of the changes below it, especially
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
66 when moving up in the tree, so that you know which change was just undone.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
67
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
68 ==============================================================================
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
69 *32.2* Jumping around the tree
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
70
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
71 So how do you get to "one two" now? You can use this command: >
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
72
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
73 :undo 2
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
74
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
75 The text is now "one two", you are below change 2. You can use the |:undo|
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
76 command to jump to below any change in the tree.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
77
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
78 Now make another change: change "one" to "not":
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
79
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
80 one ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
81 |
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
82 change 1
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
83 |
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
84 one too ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
85 / \
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
86 change 2 change 3
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
87 | |
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
88 one two me too ~
799
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
89 |
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
90 change 4
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
91 |
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
92 not two ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
93
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
94 Now you change your mind and want to go back to "me too". Use the |g-|
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
95 command. This moves back in time. Thus it doesn't walk the tree upwards or
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
96 downwards, but goes to the change made before.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
97
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
98 You can repeat |g-| and you will see the text change:
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
99 me too ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
100 one two ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
101 one too ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
102 one ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
103
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
104 Use |g+| to move forward in time:
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
105 one ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
106 one too ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
107 one two ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
108 me too ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
109 not two ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
110
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
111 Using |:undo| is useful if you know what change you want to jump to. |g-| and
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
112 |g+| are useful if you don't know exactly what the change number is.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
113
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
114 You can type a count before |g-| and |g+| to repeat them.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
115
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
116 ==============================================================================
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
117 *32.3* Time travelling
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
118
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
119 When you have been working on text for a while the tree grows to become big.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
120 Then you may want to go to the text of some minutes ago.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
121
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
122 To see what branches there are in the undo tree use this command: >
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
123
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
124 :undolist
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
125 < number changes time ~
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
126 3 2 16 seconds ago
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
127 4 3 5 seconds ago
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
128
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
129 Here you can see the number of the leaves in each branch and when the change
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
130 was made. Assuming we are below change 4, at "not two", you can go back ten
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
131 seconds with this command: >
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
132
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
133 :earlier 10s
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
134
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
135 Depending on how much time you took for the changes you end up at a certain
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
136 position in the tree. The |:earlier| command argument can be "m" for minutes
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
137 and "h" for hours. To go all the way back use a big number: >
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
138
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
139 :earlier 10h
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
140
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
141 To travel forward in time again use the |:later| command: >
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
142
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
143 :later 1m
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
144
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
145 The arguments are "s", "m" and "h", just like with |:earlier|.
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
146
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
147 ==============================================================================
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
148
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
149 Next chapter: |usr_40.txt| Make new commands
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
150
6beb2c667935 updated for version 7.0b
vimboss
parents:
diff changeset
151 Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: