If you want to highlight a word under the cursor like *, but don’t want to move the cursor, then I suggest the following:
nnoremap <silent> <2-LeftMouse> :let @/='\V\<'.escape(expand('<cword>'), '\').'\>'<cr>:set hls<cr>
(@/) 'hlsearch', . @/, , , * #.
:
<silent> -<2-LeftMouse> -@/ - , / ?expand('<cword>')escape(pattern, '\')\V , /\< \>, ,set hls 'hlsearch',
@/ , :match, :
nnoremap <silent> <2-leftMouse> :exe 'highlight DoubleClick ctermbg=green guibg=green<bar>match DoubleClick /\V\<'.escape(expand('<cword>'), '\').'\>/'<cr>
To clear matches, use:
:match none
source
share