Quick links: help overview · quick reference · reference manual toc · command index
undo.txt For Vim version 5.6. Last change: 1999 Dec 21 VIM REFERENCE MANUAL by Bram Moolenaar Undo and redo undo-redo 1. Undo and redo commands undo-commands 3. Remarks about undo undo-remarks ============================================================================== 1. Undo and redo commands undo-commands <Undo> or undo <Undo> u u Undo [count] changes. {Vi: only one level} :u :un :undo :u[ndo] Undo one change. {Vi: only one level} CTRL-R CTRL-R Redo [count] changes which were undone. {Vi: redraw screen} :red :redo redo :red[o] Redo one change which was undone. {Vi: no redo} The last changes are remembered. You can use the undo and redo commands above to revert the text to how it was before each change. You can also apply the changes again, getting back the text before the undo. ============================================================================== 3. Remarks about undo undo-remarks The numbered registers can also be used for undoing deletes. Each time you delete text, it is put into register "1. The contents of register "1 are shifted to "2, etc. The contents of register "9 are lost. You can now get back the most recent deleted text with the put command: '"1P'. (also, if the deleted text was the result of the last delete or copy operation, 'P' or 'p' also works as this puts the contents of the unnamed register). You can get back the text of three deletes ago with '"3P'. If you want to get back more than one part of deleted text, you can use a special feature of the repeat command ".". It will increase the number of the register used. So if you first do ""1P", the following "." will result in a '"2P'. Repeating this will result in all numbered registers being inserted. Example: If you deleted text with 'dd....' it can be restored with '"1P....'. If you don't know in which register the deleted text is, you can use the :display command. An alternative is to try the first register with '"1P', and if it is not what you want do 'u.'. This will remove the contents of the first put, and repeat the put command for the second register. Repeat the 'u.' until you got what you want. vim:tw=78:ts=8:sw=8:noet:
Quick links: help overview · quick reference · reference manual toc · command index