forked from aniani/vim
Added ":earlier 1f" and ":later 1f".
This commit is contained in:
@@ -5797,6 +5797,8 @@ undotree() *undotree()*
|
||||
something readable.
|
||||
"save_last" Number of the last file write. Zero when no
|
||||
write yet.
|
||||
"save_cur" Number of the current position in the undo
|
||||
tree.
|
||||
"synced" Non-zero when the last undo block was synced.
|
||||
This happens when waiting from input from the
|
||||
user. See |undo-blocks|.
|
||||
|
||||
@@ -145,6 +145,16 @@ g- Go to older text state. With a count repeat that many
|
||||
:earlier {N}s Go to older text state about {N} seconds before.
|
||||
:earlier {N}m Go to older text state about {N} minutes before.
|
||||
:earlier {N}h Go to older text state about {N} hours before.
|
||||
:earlier {N}d Go to older text state about {N} days before.
|
||||
|
||||
:earlier {N}f Go to older text state {N} file writes before.
|
||||
When changes were made since the laste write
|
||||
":earlier 1f" will revert the text to the state when
|
||||
it was written. Otherwise it will go to the write
|
||||
before that.
|
||||
When at the state of the first file write, or when
|
||||
the file was not written, ":earlier 1f" will go to
|
||||
before the first change.
|
||||
|
||||
*g+*
|
||||
g+ Go to newer text state. With a count repeat that many
|
||||
@@ -154,6 +164,11 @@ g+ Go to newer text state. With a count repeat that many
|
||||
:later {N}s Go to newer text state about {N} seconds later.
|
||||
:later {N}m Go to newer text state about {N} minutes later.
|
||||
:later {N}h Go to newer text state about {N} hours later.
|
||||
:later {N}d Go to newer text state about {N} days later.
|
||||
|
||||
:later {N}f Go to newer text state {N} file writes later.
|
||||
When at the state of the last file write, ":later 1f"
|
||||
will go to the newest text state.
|
||||
|
||||
|
||||
Note that text states will become unreachable when undo information is cleared
|
||||
|
||||
@@ -302,7 +302,7 @@ edited. Typing this command twice cancels the preceding "U".
|
||||
|
||||
The "U" command is a change by itself, which the "u" command undoes and CTRL-R
|
||||
redoes. This might be a bit confusing. Don't worry, with "u" and CTRL-R you
|
||||
can go to any of the situations you had. More about that in section |32.1|.
|
||||
can go to any of the situations you had. More about that in section |32.2|.
|
||||
|
||||
==============================================================================
|
||||
*02.6* Other editing commands
|
||||
|
||||
@@ -9,16 +9,40 @@ 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| Numbering changes
|
||||
|32.2| Jumping around the tree
|
||||
|32.3| Time travelling
|
||||
|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* Numbering changes
|
||||
*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
|
||||
diferent 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
|
||||
@@ -66,7 +90,7 @@ 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.2* Jumping around the tree
|
||||
*32.3* Jumping around the tree
|
||||
|
||||
So how do you get to "one two" now? You can use this command: >
|
||||
|
||||
@@ -114,7 +138,7 @@ Using |:undo| is useful if you know what change you want to jump to. |g-| and
|
||||
You can type a count before |g-| and |g+| to repeat them.
|
||||
|
||||
==============================================================================
|
||||
*32.3* Time travelling
|
||||
*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.
|
||||
@@ -133,10 +157,10 @@ 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
|
||||
and "h" for hours. To go all the way back use a big number: >
|
||||
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 10h
|
||||
:earlier 100d
|
||||
|
||||
To travel forward in time again use the |:later| command: >
|
||||
|
||||
@@ -144,6 +168,11 @@ To travel forward in time again use the |:later| command: >
|
||||
|
||||
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
|
||||
|
||||
@@ -273,9 +273,10 @@ Subjects that can be read independently.
|
||||
|31.5| Various
|
||||
|
||||
|usr_32.txt| The undo tree
|
||||
|32.1| Numbering changes
|
||||
|32.2| Jumping around the tree
|
||||
|32.3| Time travelling
|
||||
|32.1| Undo up to a file write
|
||||
|32.2| Numbering changes
|
||||
|32.3| Jumping around the tree
|
||||
|32.4| Time travelling
|
||||
|
||||
==============================================================================
|
||||
Tuning Vim ~
|
||||
|
||||
Reference in New Issue
Block a user