In general, you can't/shouldn't "create a custom colorscheme in which define custom highlight group each of containing set of words".
What you can/should do:
- define your colorscheme file where for the color groups specific colors are defined (example snip):
let g:colors_name = 'mycolorscheme'
hi Comment guifg=#007f7f
hi Constant guifg=#ffa0a0
"... other color groups if needed. Otherwise default values would be used.
- define syntax file that create syntax elements such as comments, keywords, constants, etc and maps them to colorgroups (existing or created by you), for example for asciidoctor syntax I have:
syn match asciidoctorComment "^//.*$"
hi def link asciidoctorComment Comment
" ... other syntax elements
Where I define what is asciidoctor comment -- something that start with double slash in the beginning of the line till the end of the line -- and map it to default Comment highlight group.
And to be closer to your questions:
- you can try to do explicit:
syntax match Comment "hello\|world"
That would make words "hello" and "world" a comment, kind of. Although it would be overwritten when you open a new file with defined syntax, so you should have find a way to properly execute this after current syntax file was loaded. (
- Well it is the same, but you have to add highlight for that group:
syntax match StylishComments "My\|Stylish\|Comments"
hi StylishComments guifg="#ffff00"
Here is the same issue as with pt.1 but it also will probably overwritten after you change colorscheme.
You can try it in vim session
:syntax ... to see if it works for you (it worked for me:). Then decide what route to go, either using autocommands in vimrc to reapply those commands after filetype and/or colorscheme was changed or create a proper syntax and colorscheme files.