Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions doc/undo.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*undo.txt* For Vim バージョン 9.1. Last change: 2024 Nov 09
*undo.txt* For Vim バージョン 9.1. Last change: 2025 Oct 12


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -277,8 +277,8 @@ Note テキストプロパティは undo ファイルには保存されません

":wundo" と ":rundo" を使うことで undo 履歴の保存と復元を手動で実行することも
できます。
*:wundo* *:rundo*
:wundo[!] {file}
*:wu* *:wundo*
:wu[ndo][!] {file}
undo 履歴を {file} に保存する。
{file} が存在し、それが undo ファイルでないなら (ファイル先頭
のマジックナンバーが違うなら)、コマンドは失敗します。それでも
Expand All @@ -290,7 +290,8 @@ Note テキストプロパティは undo ファイルには保存されません
制限のかかったディレクトリ内の undo ファイルは上書きできませ
ん。

:rundo {file} {file} から undo 履歴を読み込む。
*:rund* *:rundo*
:rund[o] {file} {file} から undo 履歴を読み込む。

自動コマンドを使うことで undo ファイルの名前を明示的に指定することができます。
例: >
Expand Down
30 changes: 16 additions & 14 deletions en/undo.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*undo.txt* For Vim version 9.1. Last change: 2024 Nov 09
*undo.txt* For Vim version 9.1. Last change: 2025 Oct 12


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -112,7 +112,7 @@ parts. E.g., for each sentence. |i_CTRL-G_u|

Setting the value of 'undolevels' also closes the undo block. Even when the
new value is equal to the old value. Use `g:undolevels` to explicitly read
and write only the global value of 'undolevels'. In |Vim9| script: >
and write only the global value of 'undolevels'. In |Vim9| script: >
&g:undolevels = &g:undolevels
In legacy script: >
let &g:undolevels = &g:undolevels
Expand Down Expand Up @@ -156,7 +156,7 @@ This is explained in the user manual: |usr_32.txt|.
MM/DD HH:MM:SS idem, with month and day
YYYY/MM/DD HH:MM:SS idem, with year
The "saved" column specifies, if this change was
written to disk and which file write it was. This can
written to disk and which file write it was. This can
be used with the |:later| and |:earlier| commands.
For more details use the |undotree()| function.

Expand Down Expand Up @@ -256,7 +256,7 @@ for, you can use a BufWritePre autocommand: >
au BufWritePre /tmp/* setlocal noundofile

Vim saves undo trees in a separate undo file, one for each edited file, using
a simple scheme that maps filesystem paths directly to undo files. Vim will
a simple scheme that maps filesystem paths directly to undo files. Vim will
detect if an undo file is no longer synchronized with the file it was written
for (with a hash of the file contents) and ignore it when the file was changed
after the undo file was written, to prevent corruption. An undo file is also
Expand All @@ -278,21 +278,22 @@ guaranteed.

You can also save and restore undo histories by using ":wundo" and ":rundo"
respectively:
*:wundo* *:rundo*
:wundo[!] {file}
*:wu* *:wundo*
:wu[ndo][!] {file}
Write undo history to {file}.
When {file} exists and it does not look like an undo file
(the magic number at the start of the file is wrong), then
this fails, unless the ! was added.
If it exists and does look like an undo file it is
overwritten. If there is no undo-history, nothing will be
overwritten. If there is no undo-history, nothing will be
written.
Implementation detail: Overwriting happens by first deleting
the existing file and then creating a new file with the same
name. So it is not possible to overwrite an existing undofile
name. So it is not possible to overwrite an existing undofile
in a write-protected directory.

:rundo {file} Read undo history from {file}.
*:rund* *:rundo*
:rund[o] {file} Read undo history from {file}.

You can use these in autocommands to explicitly specify the name of the
history file. E.g.: >
Expand Down Expand Up @@ -384,11 +385,12 @@ information you can use these commands: >

Note use of `&l:undolevels` to explicitly read the local value of 'undolevels'
and the use of `:setlocal` to change only the local option (which takes
precedence over the corresponding global option value). Saving the option value
via the use of `&undolevels` is unpredictable; it reads either the local value
(if one has been set) or the global value (otherwise). Also, if a local value
has been set, changing the option via `:set undolevels` will change both the
global and local values, requiring extra work to save and restore both values.
precedence over the corresponding global option value). Saving the option
value via the use of `&undolevels` is unpredictable; it reads either the local
value (if one has been set) or the global value (otherwise). Also, if a local
value has been set, changing the option via `:set undolevels` will change both
the global and local values, requiring extra work to save and restore both
values.

Marks for the buffer ('a to 'z) are also saved and restored, together with the
text.
Expand Down