Lines Matching refs:undo
1 *undo.txt* For Vim version 8.2. Last change: 2020 Nov 30
7 Undo and redo *undo-redo*
11 1. Undo and redo commands |undo-commands|
12 2. Two ways of undo |undo-two-ways|
13 3. Undo blocks |undo-blocks|
14 4. Undo branches |undo-branches|
15 5. Undo persistence |undo-persistence|
16 6. Remarks about undo |undo-remarks|
19 1. Undo and redo commands *undo-commands*
21 <Undo> or *undo* *<Undo>* *u*
24 *:u* *:un* *:undo*
27 :u[ndo] {N} Jump to after change number {N}. See |undo-branches|
41 The last changes are remembered. You can use the undo and redo commands above
43 changes again, getting back the text before the undo.
45 The "U" command is treated by undo/redo just like any other command. Thus a
52 Use "u" to undo changes until the buffer becomes unchanged.
55 2. Two ways of undo *undo-two-ways*
57 How undo and redo commands work depends on the 'u' flag in 'cpoptions'.
60 nothing (undoes an undo).
63 You can go back in time with the undo command. You can then go forward again
64 with the redo command. If you make a new change after the undo command,
68 The undo command undoes the previous change, and also the previous undo
69 command. The redo command repeats the previous undo command. It does NOT
73 "uu" two times undo no-op
74 "u CTRL-R" no-op two times undo
81 3. Undo blocks *undo-blocks*
83 One undo command normally undoes a typed command, no matter how many changes
84 that command makes. This sequence of undo-able changes forms an undo block.
92 :undoj[oin] Join further changes with the previous undo block.
94 properly undoing changes. Don't use this after undo
106 After this a "u" command will undo the delete command and the previous
109 To do the opposite, break a change into two undo blocks, in Insert mode use
112 Setting the value of 'undolevels' also breaks undo. Even when the new value
116 4. Undo branches *undo-branches* *undo-tree*
118 Above we only discussed one line of undo/redo. But it is also possible to
119 branch off. This happens when you undo a few changes and then make a new
135 specific undo-able change, see |:undo|.
183 Note that text states will become unreachable when undo information is cleared
187 place at a time. This happens when moving through the undo tree and then
200 Now undo that by pressing "u" three times:
210 Now undo that by using "g-" three times:
215 You are now back in the first undo branch, after deleting "one". Repeating
232 5. Undo persistence *undo-persistence* *persistent-undo*
236 your undo history when you write a file and restore undo history when you edit
240 autocommands. If you want to control what files to write undo information
244 Vim saves undo trees in a separate undo file, one for each edited file, using
245 a simple scheme that maps filesystem paths directly to undo files. Vim will
246 detect if an undo file is no longer synchronized with the file it was written
248 after the undo file was written, to prevent corruption. An undo file is also
250 the owner of the undo file is the current user. Set 'verbose' to get a
256 When the file is encrypted, the text in the undo file is also crypted. The
259 Note that text properties are not stored in the undo file. You can restore
261 from an undo file. Rationale: It would require the associated text property
265 You can also save and restore undo histories by using ":wundo" and ":rundo"
269 Write undo history to {file}.
270 When {file} exists and it does not look like an undo file
273 If it exists and does look like an undo file it is
274 overwritten. If there is no undo-history, nothing will be
281 :rundo {file} Read undo history from {file}.
301 You should keep 'undofile' off, otherwise you end up with two undo files for
311 NOTE: undo files are never deleted by Vim. You need to delete them yourself.
313 Reading an existing undo file may fail for several reasons:
316 means it is not an undo file.
317 *E824* The version number of the undo file indicates that it's written by a
319 write the buffer if you want to keep the undo info in the file.
320 "File contents changed, cannot use undo info"
321 The file text differs from when the undo file was written. This means
322 the undo file cannot be used, it would corrupt the text. This also
323 happens when 'encoding' differs from when the undo file was written.
324 *E825* The undo file does not contain valid contents and cannot be used.
325 *E826* The undo file is encrypted but decryption failed.
326 *E827* The undo file is encrypted but this version of Vim does not support
328 *E832* The undo file is encrypted but 'key' is not set, the text file is not
331 You probably want to delete this undo file.
332 "Not reading undo file, owner differs"
333 The undo file is owned by someone else than the owner of the text
334 file. For safety the undo file is not used.
336 Writing an undo file may fail for these reasons:
339 "Cannot write undo file in any directory in 'undodir'"
341 "Will not overwrite with undo file, cannot read"
342 A file exists with the name of the undo file to be written, but it
344 "Will not overwrite, this is not an undo file"
345 A file exists with the name of the undo file to be written, but it
348 "Skipping undo file write, nothing to undo"
349 There is no undo information to be written, nothing has been changed
351 *E829* An error occurred while writing the undo file. You may want to try
355 6. Remarks about undo *undo-remarks*
359 undo is possible. Use this if you are running out of memory.
361 *clear-undo*
362 When you set 'undolevels' to -1 the undo information is not immediately
363 cleared, this happens at the next change. To force clearing the undo