How to highlight the word under cursor in vim.
Currently I do this by getting the word under cursor and then pressing *
.
Sure, this does highlight the text, but the cursor moves to the next found word in the file (if the word exists more than once). But, I want the cursor to stay on the same word, while highlighting it.
I added this function, it allows you to toggle highlighting of max 6 words in different colors by pressing <leader> 1-6
, <leader> -0
will clear all highlighting.
https://github.com/sk1418/myConf/blob/master/common/.vimrc#L729
the original idea was from sjl.