Simple extensible markup based colour message (:echo) printer
Chroma is an extensible, markup based colour (:echo) printer for Vim. It uses a simple tag markup similar to common lightweight text markup tools, like markdown, asciidoc and restructured text.
Chroma provides three mechanisms to generate coloured printing:
-
a g:chroma object with a print(msg) method
-
a :Chroma command that accesses the g:chroma object
-
a Chroma() object factory for generating custom chroma objects
The set of built-in tags and their corresponding highlight-groups are:
-
! text ! — Error
-
* text * — WarningMsg
-
+ text + — Type
-
/ text / — Keyword
-
_ text _ — Label
The public API of the Chroma class is:
-
print(msg) — Command to colour print the given marked-up msg
call chroma.print("!Error!: You /can't/ do _that_ on +television+!")
-
add(tag, highlight) — Allow text marked up as <tag>text<tag> to be highlighted with the given group
call chroma.add('@', 'ModeMsg') call chroma.print("!Error!: @You@ /can't/ do _that_ on +television+!")
-
del(tag) — Prevent text marked up as <tag>text<tag> from being coloured
call chroma.del('@') call chroma.print("!Error!: @You@ /can't/ do *that* on +television+!")
Now prints: @You@ instead of 'You' in colour.
-
set(tag, highlight) — An alias for add(tag, highlight)