Vim Recall繁體中文

Adjust a number with a count

5<C-a> or 5<C-x>

Example

Normal mode. Cursor on 12 in retries = 12.

Before
retries = 12
Cursor on line 1, column 11
  1. 5<C-a> Add 5 · retries = 17
After
retries = 17
Cursor on line 1, column 12
Details & Vim help

Add or subtract a count from the first number at or after the cursor on the current line.

Update quantities without selecting and retyping digits.

nrformats controls recognized formats, including hexadecimal and optional octal or alphabetic values. In Normal mode g Ctrl-a is not the Visual sequence command.

Try it in Vim

  1. Place the Normal-mode cursor on the number.
  2. Type 5 then Ctrl-a to add five.
  3. Use 5 then Ctrl-x to subtract five instead.