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

How do you retrieve a register's contents in Vimscript?

Answer

:echo getreg('a')

Explanation

Use getreg('a') to get the contents of register a as a string. Useful in scripts and mappings that need to process register contents.

Next

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