Question

I am trying to remap the * operator in VIM. I have tried nnoremap <*> and nnoremap <S-8> to no avail. I haven't been able to find any instructions on how to properly do this. How can I remap my *, or any number keys/number key special characters?

Since many of you will no doubt wonder why anyone would want to do this, it's so I can make my * operator behave like normal, except not advance automatically to the next occurrence of the word under cursor (see under section Highlight Matches Without Moving).

EDIT:

The complete command I'm working with is this:

nnoremap <*> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>

Where * remaps the functionality of * or <shift + 8>

Was it helpful?

Solution

Getting rid of the < and > works for me.

nnoremap * :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>

OTHER TIPS

Try nnoremap <F7> <*>. It will remap the * with F7

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top