Add the word under the cursor in different highlight groups.
Each group has a different color.
Use your favorite plugin manager.
Using vim-plug:
Plug 'antoinemadec/vim-highlight-groups'
Add this in your .vimrc
:
nnoremap <silent> <F5> :HighlightGroupsAddWord 13 1<CR>
nnoremap <silent> \<F5> :HighlightGroupsClearGroup 13 1<CR>
nnoremap <silent> <F6> :HighlightGroupsAddWord 17 1<CR>
nnoremap <silent> \<F6> :HighlightGroupsClearGroup 17 1<CR>
To highlight the word under the cursor:
:HighlightGroupsClearGroup <group_nb> <all_window>
:HighlightGroupsAddWord <group_nb> <all_window>
Core functions:
" function MatchAdd(group_name, hl, pattern, priority)
" function MatchDelete(group_name)
call MatchAdd('my_own_group', 'IncSearch', '\s\+$', 11)
call MatchAdd('my_own_group', 'Error', 'compilation failed', 11)
call MatchDelete('my_own_group')
Copyright (c) Antoine Madec. Distributed under the same terms as Vim itself. See :help license.