I'm trying to do this:
nnoremap <leader>* :let @/ ="<cword>"<cr><bar>:set hlsearch<cr>
but can't get the first bit to work
nnoremap <leader>* :let @/ ="<cword>"<cr>
I want to highlight the word under the cursor but not jump to the next match automatically (often this is useful if you have multiple files open and you want to highlight a function definition in another file where you are using the function in the first file.
I came up with the
let bit after reading
:h @/ and given
:let is an ex command I thought I'd be able to use
I've got stuck with adding or removing the quotes - no quotes gives an error and quotes just makes it search for
"<cword>" literally. Likewise I also tried single quotes.
I'd be open to other ways of achieving the same thing but I'd also like to get to the bottom of why this doesn't work