Vim Recall繁體中文

Undo recent changes on a line

U

Example

Normal 0 / 1
ne two
Cursor on line 1, column 1

Restore the line where the latest change was made.

Before & after
Before
ne two
Cursor on line 1, column 1
After
one two
Cursor on line 1, column 1

Start in Normal mode. Before is prepared by deleting the first character with x; the example then demonstrates the displayed command.

Details & Vim help

Example replayed in Vim

Restore the line where the latest change was made.

U undoes the latest changes on that one line, not an arbitrary line selected by moving the cursor. U itself counts as a change, so u can undo it and another U can reverse it.