Calculate into your text
<C-r>=6*7<CR>
Example
Insert mode after “Total: ”, including its trailing space.
Total: - <C-r>= Expression prompt opens
- 6*7<CR> Total: 42 · stays in Insert mode
Total: 42Details & Vim help
Evaluate a Vim expression and insert its result.
Fill in a computed value without switching to a calculator.
This uses Vim’s expression language. Only evaluate expressions you understand; function calls may have side effects.
Insert-mode cursor starts at the end of the line.
Try it in Vim
- In Insert mode, press Ctrl-r and then =.
- Type 6*7 at the expression prompt.
- Press <CR> to insert the result.