I would not have thought that this would be hard to do, but it's not working. What I'm trying to do is enable the search highlight from script. I've tried the following:
function! g:TestFunc() let @/ ="testtext" set hlsearch endfunction nnoremap <space> :call g:TestFunc()<cr>
Which doesn't work. That is, hitting space in front of some text with "testtext" in it does not highlight the text. The user still has to hit 'n'.
I also tried adding
exec 'normal! n' to the end of the function but that also didn't work. Even