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.
:let @/ = 'pattern'
Use :let @/ = 'pattern' to set the search register directly. Combined with set hlsearch, this highlights matches without moving the cursor.