Referring to answer from this link..
Adding two groups,
:highlight MyGroup1 ctermbg=green guibg=green
:highlight MyGroup2 ctermbg=blue guibg=blue
Then adding two words foo
and bar
into specific groups.
:call matchadd("MyGroup1", "foo")
:call matchadd("MyGroup2", "bar")
But how to make sure that the exact words foo
is highlighted and not some conjunction word bigwordwithfoo
.