Notepad++ has this really neat feature that if you select one word, every other occurence of the word is automatically highlighted, like this (only the first autocmd is highlighted by me):
I am aware that a similar thing has already been asked, but I am hoping that there is a solution which does not require manual interaction.
If you press *
Vim will search for all occurrences of the word under the cursor.
If you have search highlighting turned on, they will be highlighted.
You can turn on search highlighting by putting this in your .vimrc
:
set hlsearch
One nice plus is you don't have to select the word anymore... you just hit the *
key.
(you could map it to another key to make it even more convenient)
If you don't like the way the cursor moves when you press *
you can prevent it with a simple mapping:
nnoremap * *N
(put it in your .vimrc)
This keeps the cursor in its current position when you press *
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With