normal·mode
~ / insert / expression-registerlesson 7/7

Do the maths in place: <C-r>=

Let Vim evaluate the arithmetic and type the answer for you.

3 drills

  1. Divide without a calculator: Finish the line with the decimal value. Type the division on the = prompt and let Vim work it out (remember the .0).
  2. Replace the sum with its answer: Swap the arithmetic for its result without doing the maths yourself: cut it with C, then <C-r>=<C-r>"<CR>.
  3. Answers with decimals: Same trick, but these answers have decimals. The .0 (or any decimal) in each expression makes Vim use floating point.

The drill editor loads in your browser.

outside the editor the page is in normal mode: ? keymaps · / find · : commandsfound this useful? ☕ support it ·credits · source · not affiliated with Vim or Neovim