lifepillar/vim-colortemplate

Feature request: change meaning of term=/t= and add cterm=/c=

romainl opened this issue · 2 comments

In the highlight command, we can have three stylistic attributes:

  • term=, for terminals without color support,
  • cterm=, for terminals with color support,
  • gui=, for the GUI.

Currently, colortemplate only has term=/t= and gui=/g=. The latter is OK but the former is ambiguous: it looks like it would apply to the final term= while it actually applies to the final cterm= in some cases (256 and 16 variants) and to the final term= in others (0 variant).

Would it be possible to do the following?

  1. Disambiguate term=/t= and make it only apply to the final term=.
  2. Add cterm=/c= to handle color terminals explicitly.

Currently, Colortemplate never generates highlight group definitions where both term and cterm are defined together. So, the term=/t= in Colortemplate should be interpreted generically as “attributes that should be applied in a terminal environment”: whether that means setting term vs cterm is an implementation detail. Do you have a use case in mind, where making the distinction would be necessary or bring some advantage?

Note that you may have different attributes in different terminal environments, e.g.:

Variant: 256
SomeHighlightGroup fgcol bgcol t=bold
Variant: 0
SomeHighlightGroup omit omit t=underline

Whereas, if the attributes are the same in both environments, you might just do:

Variant: 0 256
SomeHighlightGroup fgcol bgcol t=bold

With your proposal, those would become:

Variant: 256
SomeHighlightGroup fgcol bgcol c=bold
Variant: 0
SomeHighlightGroup omit omit t=underline

and

Variant: 0 256
SomeHighlightGroup fgcol bgcol c=bold t=bold

respectively.

I am closing this. I am not going to change it for Colortemplate v2, as the current syntax has been supported for a long time, and I don't see any significant advantage in changing it. Colortemplate v3 (coming soon!) uses a more declarative approach and does not have term/gui keywords.