更新时间:2021-07-03 19:33:39
将当前缓冲区恢复到Vim撤消列表中记录的第一个
更改之前的状态(请参见:help undo-tree $ ),我们
可以使用:undo
命令的两个连续调用:
To revert the current buffer to the state prior to the very first
change recorded in the Vim undo list (see :help undo-tree
), we
can use two consecutive invocations of the :undo
command:
:u1|u
第一个命令(:undo 1
)在第一个已注册的更改
之后恢复到缓冲区的状态,而第二个命令(:undo
)
会自动还原第一个更改。
The first command (:undo 1
) reverts to the state of the buffer after
the very first registered change, while the second command (:undo
)
reverts that first change itself.
从8.1版开始(请参见:helpg补丁8.0.1441
),Vim允许$ b $ b传递更改数字0作为:undo
命令的参数
在进行任何已更改之前引用状态,从而使
可以达到相同的效果一次调用即可完成:
Starting with version 8.1 (see :helpg Patch 8.0.1441
), Vim allows
to pass the change number 0 as an argument to the :undo
command
to refer to the state before any registered changes, thus making
it possible to achieve the same effect in a single invocation:
:u0