- Temporary register that can be used to run snippets of Vim script
- Can be used to evaluate Vim scripts without leaving the current editor context
- Can also perform mathematical calculations
How to enter "expression register" mode?
<ctrl-r>=from insert mode
- Result of the expression is printed at the cursor position
Example
Typing
2 + 3in the expression register and pressing<Enter>will print the output (5) at the cursor position
How to evaluate an expression already present in the file?
- In visual mode, select the expression
yankthe expression into Vim’s default register, usingy- Enter into expression register
<ctrl-r>"will help you paste theyankedexpression into the register<enter>will perform the calculation and print the result at the cursor position