Vim Recall繁體中文

Don't break undo with next cursor movement

Ctrl-g U

Example

Insert 0 / 5
ab
Insertion point on line 1, column 3

Don't break undo with next cursor movement.

Illustrated undo history

Current block
typed ab
Before & after
Before
ab
Insertion point on line 1, column 3

Illustrated undo history

Current block
typed ab
After
Cursor on line 1, column 1

Illustrated undo history

Result
Original empty line restored

ILLUSTRATION. Insert mode follows typing ab into an empty line. The next left movement stays on this line, so it can retain the same undo block.

Details & Vim help

Don't break undo with next cursor movement. Use in Insert mode. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.