Vim Recall繁體中文

Increment a number

Ctrl-a

Example

Normal 0 / 1
item 12
Cursor on line 1, column 6

Add one to the number at or after the cursor on the current line.

Before & after
Before
item 12
Cursor on line 1, column 6
After
item 13
Cursor on line 1, column 7

Start in Normal mode. Cursor starts on the 1 of the decimal number. Press Ctrl-a.

Details & Vim help

Example replayed in Vim

Add one to the number at or after the cursor on the current line.

Vim searches at or to the right on the current line for a supported number. A count such as 5Ctrl-a adds five. Number bases and alphabetic handling depend on nrformats.