Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I see this intriguing feature in Notepad++.

For the same in vim I need to:

  • click on a word
  • press *

If I'd like to check different words, I need to press * many times. And it will automatically move my cursor to next matching word, which is not I want.

Can this be done like auto-highlighting and don't move my cursor?

share|improve this question

You have a few short scripts on this page.

share|improve this answer
up vote 0 down vote accepted

Finally found how to do it: add following into .vimrc

autocmd CursorMoved * silent! exe printf('match Search /\<%s\>/', expand('<cword>'))
autocmd CursorHold *  silent! exe printf('match Search /\<%s\>/', expand('<cword>'))

And you can also replace the Search above with whatever highlight you like, even self-defined scheme.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.