annotate runtime/doc/undo.txt @ 1912:fcf44bf1218f v7.2.209

updated for version 7.2-209
author vimboss
date Tue, 16 Jun 2009 16:29:10 +0000
parents 5232b9862f23
children de5a43c5eedc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
1 *undo.txt* For Vim version 7.2. Last change: 2006 Apr 30
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 VIM REFERENCE MANUAL by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 Undo and redo *undo-redo*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 The basics are explained in section |02.5| of the user manual.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 1. Undo and redo commands |undo-commands|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 2. Two ways of undo |undo-two-ways|
697
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
13 3. Undo blocks |undo-blocks|
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
14 4. Undo branches |undo-branches|
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
15 5. Remarks about undo |undo-remarks|
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 1. Undo and redo commands *undo-commands*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 <Undo> or *undo* *<Undo>* *u*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 u Undo [count] changes. {Vi: only one level}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 *:u* *:un* *:undo*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 :u[ndo] Undo one change. {Vi: only one level}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
772
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
26 :u[ndo] {N} Jump to after change number {N}. See |undo-branches|
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
27 for the meaning of {N}. {not in Vi}
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
28
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 *CTRL-R*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 CTRL-R Redo [count] changes which were undone. {Vi: redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 screen}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 *:red* *:redo* *redo*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 :red[o] Redo one change which was undone. {Vi: no redo}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 *U*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 U Undo all latest changes on one line. {Vi: while not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 moved off of it}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 The last changes are remembered. You can use the undo and redo commands above
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 to revert the text to how it was before each change. You can also apply the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 changes again, getting back the text before the undo.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 The "U" command is treated by undo/redo just like any other command. Thus a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 "u" command undoes a "U" command and a 'CTRL-R' command redoes it again. When
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 mixing "U", "u" and 'CTRL-R' you will notice that the "U" command will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 restore the situation of a line to before the previous "U" command. This may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 be confusing. Try it out to get used to it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 The "U" command will always mark the buffer as changed. When "U" changes the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 buffer back to how it was without changes, it is still considered changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 Use "u" to undo changes until the buffer becomes unchanged.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 2. Two ways of undo *undo-two-ways*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 How undo and redo commands work depends on the 'u' flag in 'cpoptions'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 There is the Vim way ('u' excluded) and the vi-compatible way ('u' included).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 In the Vim way, "uu" undoes two changes. In the Vi-compatible way, "uu" does
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 nothing (undoes an undo).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 'u' excluded, the Vim way:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 You can go back in time with the undo command. You can then go forward again
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 with the redo command. If you make a new change after the undo command,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 the redo will not be possible anymore.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 'u' included, the Vi-compatible way:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 The undo command undoes the previous change, and also the previous undo command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 The redo command repeats the previous undo command. It does NOT repeat a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 change command, use "." for that.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 Examples Vim way Vi-compatible way ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 "uu" two times undo no-op
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 "u CTRL-R" no-op two times undo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 Rationale: Nvi uses the "." command instead of CTRL-R. Unfortunately, this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 is not Vi compatible. For example "dwdwu." in Vi deletes two
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 words, in Nvi it does nothing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 ==============================================================================
697
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
80 3. Undo blocks *undo-blocks*
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
81
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
82 One undo command normally undoes a typed command, no matter how many changes
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
83 that command makes. This sequence of undo-able changes forms an undo block.
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
84 Thus if the typed key(s) call a function, all the commands in the function are
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
85 undone together.
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
86
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
87 If you want to write a function or script that doesn't create a new undoable
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
88 change but joins in with the previous change use this command:
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
89
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 834
diff changeset
90 *:undoj* *:undojoin* *E790*
697
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
91 :undoj[oin] Join further changes with the previous undo block.
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
92 Warning: Use with care, it may prevent the user from
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 834
diff changeset
93 properly undoing changes. Don't use this after undo
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 834
diff changeset
94 or redo.
697
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
95 {not in Vi}
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
96
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
97 This is most useful when you need to prompt the user halfway a change. For
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
98 example in a function that calls |getchar()|. Do make sure that there was a
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
99 related change before this that you must join with.
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
100
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
101 This doesn't work by itself, because the next key press will start a new
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
102 change again. But you can do something like this: >
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
103
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
104 :undojoin | delete
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
105
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
106 After this an "u" command will undo the delete command and the previous
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
107 change.
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
108
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
109 ==============================================================================
827
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 825
diff changeset
110 4. Undo branches *undo-branches* *undo-tree*
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
111
793
8c0b00d50acf updated for version 7.0231
vimboss
parents: 772
diff changeset
112 Above we only discussed one line of undo/redo. But it is also possible to
8c0b00d50acf updated for version 7.0231
vimboss
parents: 772
diff changeset
113 branch off. This happens when you undo a few changes and then make a new
8c0b00d50acf updated for version 7.0231
vimboss
parents: 772
diff changeset
114 change. The undone changes become a branch. You can go to that branch with
8c0b00d50acf updated for version 7.0231
vimboss
parents: 772
diff changeset
115 the following commands.
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
116
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 793
diff changeset
117 This is explained in the user manual: |usr_32.txt|.
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
118
772
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
119 *:undol* *:undolist*
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
120 :undol[ist] List the leafs in the tree of changes. Example:
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
121 number changes time ~
856
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
122 4 10 10:34:11
8cd729851562 updated for version 7.0g
vimboss
parents: 842
diff changeset
123 18 4 11:01:46
772
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
124
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
125 The "number" column is the change number. This number
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
126 continuously increases and can be used to identify a
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
127 specific undo-able change, see |:undo|.
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
128 The "changes" column is the number of changes to this
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
129 leaf from the root of the tree.
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
130 The "time" column is the time this change was made.
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
131
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
132 *g-*
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
133 g- Go to older text state. With a count repeat that many
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
134 times. {not in Vi}
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
135 *:ea* *:earlier*
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
136 :earlier {count} Go to older text state {count} times.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
137 :earlier {N}s Go to older text state about {N} seconds before.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
138 :earlier {N}m Go to older text state about {N} minutes before.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
139 :earlier {N}h Go to older text state about {N} hours before.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
140
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
141 *g+*
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
142 g+ Go to newer text state. With a count repeat that many
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
143 times. {not in Vi}
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
144 *:lat* *:later*
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
145 :later {count} Go to newer text state {count} times.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
146 :later {N}s Go to newer text state about {N} seconds later.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
147 :later {N}m Go to newer text state about {N} minutes later.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
148 :later {N}h Go to newer text state about {N} hours later.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
149
772
aaaca5077255 updated for version 7.0226
vimboss
parents: 758
diff changeset
150
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
151 Note that text states will become unreachable when undo information is cleared
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
152 for 'undolevels'.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
153
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
154 Don't be surprised when moving through time shows multiple changes to take
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
155 place at a time. This happens when moving through the undo tree and then
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
156 making a new change.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
157
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
158 EXAMPLE
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
159
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
160 Start with this text:
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
161 one two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
162
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
163 Delete the first word by pressing "x" three times:
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
164 ne two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
165 e two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
166 two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
167
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
168 Now undo that by pressing "u" three times:
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
169 e two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
170 ne two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
171 one two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
172
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
173 Delete the second word by pressing "x" three times:
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
174 one wo three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
175 one o three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
176 one three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
177
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
178 Now undo that by using "g-" three times:
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
179 one o three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
180 one wo three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
181 two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
182
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
183 You are now back in the first undo branch, after deleting "one". Repeating
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
184 "g-" will now bring you back to the original text:
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
185 e two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
186 ne two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
187 one two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
188
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
189 Jump to the last change with ":later 1h":
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
190 one three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
191
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
192 And back to the start again with ":earlier 1h":
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
193 one two three ~
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
194
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
195
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
196 Note that using "u" and CTRL-R will not get you to all possible text states
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
197 while repeating "g-" and "g+" does.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
198
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
199 ==============================================================================
d591d4ceeaee updated for version 7.0224
vimboss
parents: 697
diff changeset
200 5. Remarks about undo *undo-remarks*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 The number of changes that are remembered is set with the 'undolevels' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 If it is zero, the Vi-compatible way is always used. If it is negative no
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 undo is possible. Use this if you are running out of memory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 Marks for the buffer ('a to 'z) are also saved and restored, together with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 text. {Vi does this a little bit different}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 When all changes have been undone, the buffer is not considered to be changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 It is then possible to exit Vim with ":q" instead of ":q!" {not in Vi}. Note
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 that this is relative to the last write of the file. Typing "u" after ":w"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 actually changes the buffer, compared to what was written, so the buffer is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 considered changed then.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 When manual |folding| is being used, the folds are not saved and restored.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 Only changes completely within a fold will keep the fold as it was, because
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 the first and last line of the fold don't change.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 The numbered registers can also be used for undoing deletes. Each time you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 delete text, it is put into register "1. The contents of register "1 are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 shifted to "2, etc. The contents of register "9 are lost. You can now get
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 back the most recent deleted text with the put command: '"1P'. (also, if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 deleted text was the result of the last delete or copy operation, 'P' or 'p'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 also works as this puts the contents of the unnamed register). You can get
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 back the text of three deletes ago with '"3P'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 *redo-register*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 If you want to get back more than one part of deleted text, you can use a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 special feature of the repeat command ".". It will increase the number of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 register used. So if you first do ""1P", the following "." will result in a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 '"2P'. Repeating this will result in all numbered registers being inserted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 Example: If you deleted text with 'dd....' it can be restored with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 '"1P....'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 If you don't know in which register the deleted text is, you can use the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 :display command. An alternative is to try the first register with '"1P', and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 if it is not what you want do 'u.'. This will remove the contents of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 first put, and repeat the put command for the second register. Repeat the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 'u.' until you got what you want.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 vim:tw=78:ts=8:ft=help:norl: