/usr/share/vim/vim82/doc
NameSizeModeActions
arabic.txt122040644editdlrm
autocmd.txt743140644editdlrm
builtin.txt3890750644editdlrm
change.txt792140644editdlrm
channel.txt503870644editdlrm
cmdline.txt501300644editdlrm
debug.txt68960644editdlrm
debugger.txt54430644editdlrm
develop.txt228610644editdlrm
diff.txt175150644editdlrm
digraph.txt620820644editdlrm
editing.txt753190644editdlrm
eval.txt1782820644editdlrm
farsi.txt5230644editdlrm
filetype.txt279980644editdlrm
fold.txt241390644editdlrm
ft_ada.txt182460644editdlrm
ft_ps1.txt21870644editdlrm
ft_raku.txt41830644editdlrm
ft_rust.txt95960644editdlrm
ft_sql.txt306970644editdlrm
gui.txt530760644editdlrm
gui_w32.txt191170644editdlrm
gui_x11.txt299060644editdlrm
hangulin.txt5980644editdlrm
hebrew.txt56660644editdlrm
help.txt90980644editdlrm
help.txt.vim-tiny14310644editdlrm
helphelp.txt159330644editdlrm
howto.txt29160644editdlrm
if_cscop.txt193250644editdlrm
if_lua.txt185460644editdlrm
if_mzsch.txt119410644editdlrm
if_ole.txt73610644editdlrm
if_perl.txt112810644editdlrm
if_pyth.txt386440644editdlrm
if_ruby.txt85160644editdlrm
if_sniff.txt2710644editdlrm
if_tcl.txt229410644editdlrm
indent.txt419020644editdlrm
index.txt811250644editdlrm
insert.txt875680644editdlrm
intro.txt389340644editdlrm
map.txt744640644editdlrm
mbyte.txt596400644editdlrm
message.txt316710644editdlrm
mlang.txt81870644editdlrm
motion.txt518910644editdlrm
netbeans.txt379820644editdlrm
options.txt4012540644editdlrm
os_390.txt47490644editdlrm
os_amiga.txt54660644editdlrm
os_beos.txt2930644editdlrm
os_dos.txt154960644editdlrm
os_haiku.txt84960644editdlrm
os_mac.txt68560644editdlrm
os_mint.txt3910644editdlrm
os_msdos.txt5230644editdlrm
os_os2.txt2990644editdlrm
os_qnx.txt40710644editdlrm
os_risc.txt3280644editdlrm
os_unix.txt26030644editdlrm
os_vms.txt329030644editdlrm
os_win32.txt144040644editdlrm
pattern.txt629490644editdlrm
pi_getscript.txt210820644editdlrm
pi_gzip.txt12940644editdlrm
pi_logipat.txt41960644editdlrm
pi_netrw.txt1818240644editdlrm
pi_paren.txt22740644editdlrm
pi_spec.txt41270644editdlrm
pi_tar.txt72470644editdlrm
pi_vimball.txt118590644editdlrm
pi_zip.txt74910644editdlrm
popup.txt396890644editdlrm
print.txt312090644editdlrm
quickfix.txt833310644editdlrm
quickref.txt724920644editdlrm
quotes.txt127480644editdlrm
README.Debian3240644editdlrm
recover.txt107200644editdlrm
remote.txt84200644editdlrm
repeat.txt435650644editdlrm
rileft.txt49380644editdlrm
russian.txt30240644editdlrm
scroll.txt137810644editdlrm
sign.txt268700644editdlrm
spell.txt640950644editdlrm
sponsor.txt68030644editdlrm
starting.txt735990644editdlrm
syntax.txt2297950644editdlrm
tabpage.txt172480644editdlrm
tags3626700644editdlrm
tags.vim-tiny300644editdlrm
tagsrch.txt402780644editdlrm
term.txt498220644editdlrm
terminal.txt570980644editdlrm
testing.txt166780644editdlrm
textprop.txt163950644editdlrm
tips.txt210890644editdlrm
todo.txt3071470644editdlrm
uganda.txt140280644editdlrm
undo.txt165840644editdlrm
usr_01.txt70810644editdlrm
usr_02.txt242290644editdlrm
usr_03.txt238720644editdlrm
usr_04.txt191310644editdlrm
usr_05.txt270230644editdlrm
usr_06.txt106380644editdlrm
usr_07.txt159950644editdlrm
usr_08.txt193790644editdlrm
usr_09.txt115020644editdlrm
usr_10.txt292000644editdlrm
usr_11.txt130250644editdlrm
usr_12.txt134330644editdlrm
usr_20.txt137330644editdlrm
usr_21.txt184560644editdlrm
usr_22.txt149990644editdlrm
usr_23.txt127440644editdlrm
usr_24.txt208270644editdlrm
usr_25.txt191760644editdlrm
usr_26.txt82590644editdlrm
usr_27.txt177090644editdlrm
usr_28.txt160200644editdlrm
usr_29.txt201210644editdlrm
usr_30.txt226580644editdlrm
usr_31.txt103990644editdlrm
usr_32.txt53780644editdlrm
usr_40.txt231950644editdlrm
usr_41.txt956260644editdlrm
usr_42.txt138530644editdlrm
usr_43.txt74090644editdlrm
usr_44.txt289480644editdlrm
usr_45.txt176880644editdlrm
usr_46.txt70960644editdlrm
usr_90.txt168360644editdlrm
usr_toc.txt95050644editdlrm
various.txt314830644editdlrm
version4.txt139110644editdlrm
version5.txt3085330644editdlrm
version6.txt5769420644editdlrm
version7.txt6747030644editdlrm
version8.txt19404660644editdlrm
vim9.txt686120644editdlrm
visual.txt218460644editdlrm
vi_diff.txt574280644editdlrm
windows.txt558980644editdlrm
workshop.txt3710644editdlrm
Edit: /usr/share/vim/vim82/doc/usr_32.txt (5378B)
*usr_32.txt* For Vim version 8.2. Last change: 2010 Jul 20 VIM USER MANUAL - by Bram Moolenaar The undo tree Vim provides multi-level undo. If you undo a few changes and then make a new change you create a branch in the undo tree. This text is about moving through the branches. |32.1| Undo up to a file write |32.2| Numbering changes |32.3| Jumping around the tree |32.4| Time travelling Next chapter: |usr_40.txt| Make new commands Previous chapter: |usr_31.txt| Exploiting the GUI Table of contents: |usr_toc.txt| ============================================================================== *32.1* Undo up to a file write Sometimes you make several changes, and then discover you want to go back to when you have last written the file. You can do that with this command: > :earlier 1f The "f" stands for "file" here. You can repeat this command to go further back in the past. Or use a count different from 1 to go back faster. If you go back too far, go forward again with: > :later 1f Note that these commands really work in time sequence. This matters if you made changes after undoing some changes. It's explained in the next section. Also note that we are talking about text writes here. For writing the undo information in a file see |undo-persistence|. ============================================================================== *32.2* Numbering changes In section |02.5| we only discussed one line of undo/redo. But it is also possible to branch off. This happens when you undo a few changes and then make a new change. The new changes become a branch in the undo tree. Let's start with the text "one". The first change to make is to append " too". And then move to the first 'o' and change it into 'w'. We then have two changes, numbered 1 and 2, and three states of the text: one ~ | change 1 | one too ~ | change 2 | one two ~ If we now undo one change, back to "one too", and change "one" to "me" we create a branch in the undo tree: one ~ | change 1 | one too ~ / \ change 2 change 3 | | one two me too ~ You can now use the |u| command to undo. If you do this twice you get to "one". Use |CTRL-R| to redo, and you will go to "one too". One more |CTRL-R| takes you to "me too". Thus undo and redo go up and down in the tree, using the branch that was last used. What matters here is the order in which the changes are made. Undo and redo are not considered changes in this context. After each change you have a new state of the text. Note that only the changes are numbered, the text shown in the tree above has no identifier. They are mostly referred to by the number of the change above it. But sometimes by the number of one of the changes below it, especially when moving up in the tree, so that you know which change was just undone. ============================================================================== *32.3* Jumping around the tree So how do you get to "one two" now? You can use this command: > :undo 2 The text is now "one two", you are below change 2. You can use the |:undo| command to jump to below any change in the tree. Now make another change: change "one" to "not": one ~ | change 1 | one too ~ / \ change 2 change 3 | | one two me too ~ | change 4 | not two ~ Now you change your mind and want to go back to "me too". Use the |g-| command. This moves back in time. Thus it doesn't walk the tree upwards or downwards, but goes to the change made before. You can repeat |g-| and you will see the text change: me too ~ one two ~ one too ~ one ~ Use |g+| to move forward in time: one ~ one too ~ one two ~ me too ~ not two ~ Using |:undo| is useful if you know what change you want to jump to. |g-| and |g+| are useful if you don't know exactly what the change number is. You can type a count before |g-| and |g+| to repeat them. ============================================================================== *32.4* Time travelling When you have been working on text for a while the tree grows to become big. Then you may want to go to the text of some minutes ago. To see what branches there are in the undo tree use this command: > :undolist < number changes time ~ 3 2 16 seconds ago 4 3 5 seconds ago Here you can see the number of the leaves in each branch and when the change was made. Assuming we are below change 4, at "not two", you can go back ten seconds with this command: > :earlier 10s Depending on how much time you took for the changes you end up at a certain position in the tree. The |:earlier| command argument can be "m" for minutes, "h" for hours and "d" for days. To go all the way back use a big number: > :earlier 100d To travel forward in time again use the |:later| command: > :later 1m The arguments are "s", "m" and "h", just like with |:earlier|. If you want even more details, or want to manipulate the information, you can use the |undotree()| function. To see what it returns: > :echo undotree() ============================================================================== Next chapter: |usr_40.txt| Make new commands Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: