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

How do you set the search register programmatically?

Answer

:let @/ = 'pattern'

Explanation

Use :let @/ = 'pattern' to set the search register directly. Combined with set hlsearch, this highlights matches without moving the cursor.

Next

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