Vim Recall繁體中文

Join next change with previous undo block

:undojoin

Example

Normal 0 / 4
e two
Cursor on line 1, column 1

Join next change with previous undo block.

Vim registers

" Unnamed register
Characterwise · Uses Small delete registern
- Small delete register
Characterwisen
· space ⇥ tab ↵ line break

Undo history

seq_cur
3
seq_last
3
save_cur
0
save_last
0
synced
1
Before & after
Before
e two
Cursor on line 1, column 1

Vim registers

" Unnamed register
Characterwise · Uses Small delete registern
- Small delete register
Characterwisen
· space ⇥ tab ↵ line break

Undo history

seq_cur
3
seq_last
3
save_cur
0
save_last
0
synced
1
After
e two
Cursor on line 1, column 1

Vim registers

" Unnamed register Changed
Characterwise · Uses Small delete registere
- Small delete register Changed
Characterwisee
· space ⇥ tab ↵ line break

Undo history

seq_cur
3
seq_last
4
save_cur
0
save_last
0
synced
1

Start in Normal mode. Separate real changes prepare undo history. For undojoin, the next x and u expose whether the changes form one undo block.

Details & Vim help

Example replayed in Vim

Join next change with previous undo block. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :undoj[oin] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative. Submitting :undojoin alone does not join a change entered with the next keypress; that keypress starts a new undo block. Use it with a related following change in the same command or script, for example :undojoin | delete. Do not use it after undo or redo. The displayed separate x and u demonstrate this limitation: u restores only the x deletion.