I am writing a plugin for Neovim using Lua.
If I have a text and some predefined arbitrary types, for example:
chita
wolf
grizzly
types: dog(green), cat(blue), bear(yellow)
And I know positions/indices of words that belong to the types.
What is a better approach to highlight words in the buffer according to the types using Lua?
Update
Looks like I can set custom highlight groups for this purpose:
hi MyDog guifg=red ctermfg=red
match MyDog /wolf/
But I still do not understand how to apply a highlight group not by pattern matching, but by positions in text.
:help /\%c
I think