I want to create a group-name Italic
that is exactly like
Normal
but with text in italic. My group-name Normal
is
set to
Normal ctermfg=251 ctermbg=234 guifg=#cccccc guibg=#242424
My questions are:
Is the right way to do it is to add
term=italic
to the settings as followshi Italic term=italic ctermfg=251 ctermbg=234 guifg=#cccccc guibg=#242424
I want to do it in a generic fashion, i.e., I want to define
Italic
such that the setting works for all colorscheme (the above will work only for my specific colorscheme). Is there a way accomplish it? something likehi Italic extends Normal term=italic
To solve this issue you can create the highlighting group by script. The function below takes three string arguments: name of the group to base highlighting on, name of the group to create, and string containing additional highlighting properties (or properties to overwrite).
Thus, the call
creates a new group called
Italic
that extendsNormal
highlighting by theterm=italic
attribute string.Note that custom highlighting groups remain unchanged on color-scheme switching. To correct this behavior you can update the group when the current color-scheme changes.