vimtricks.wiki Concise Vim tricks, one at a time.

How do you use the expression register to evaluate Vimscript?

Answer

<C-r>=expand('%:t')<CR>

Explanation

In insert mode, <C-r>= opens the expression register. Type any Vimscript expression like expand('%:t') to insert the filename without path.

Next

How do you yank a single word into a named register?