How do I evaluate a Vim expression and paste the result directly from a register?
Answer
"=strftime('%F')<CR>p
Explanation
The expression register lets you compute text on demand and insert it without leaving Normal mode workflows. "=strftime('%F')<CR>p evaluates a Vim expression, stores the result in the expression register, then puts it into the buffer. This is useful when you need dynamic values such as timestamps, arithmetic results, or transformed strings while staying inside an operator/motion rhythm.
How it works
"=opens the expression register promptstrftime('%F')is the Vim expression being evaluated (YYYY-MM-DD)<CR>confirms and stores the evaluated resultpputs that result after the cursor
Example
Given this line with the cursor on DATE::
Release DATE:
Type:
"=strftime('%F')<CR>p
Result:
Release DATE: 2026-03-27
Tips
- Replace
strftime('%F')with any Vim expression, for exampletoupper('abc')orline('.') - The same expression-register idea also works in Insert mode and command-line mode when you need computed text inline