RFC: Functions to create and get highlight groups

7 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Oct 16, 2021, 11:27:27 PM10/16/21
to vim_dev
Hi all,

Currently, highlight groups are created and displayed using the
":highlight" Ex command. There are no built-in functions to create or
get the highlight groups.

The proposal is to add two new functions hlget() and hlset() to get and
create/modify highlight groups.

The hlget() function returns the List of highlight groups. For each
highlight group a dictionary with the following items is returned:

name: highlight group
id: highlight ID
term: a dictionary with an item for each term attribute (bold, underline, etc.)
start: terminal codes
stop: terminal codes
ctermfg: terminal foreground color
ctermbg: terminal background color
ctermul: terminal underline color
gui: a dictionary with an item for each gui attribute (bold, underline, etc.)
guifg: gui foreground color
guibg: gui background color
guisp: gui special color
font: gui font name
linksto: linked highlight group
cleared: present, when the highlight group is cleared

The hlget() function accepts an optional highlight group name. If
present,then information about only this highlight group is returned.

The hlset() function accepts the List value returned by the hlget()
function and either creates or modifies one or more highlight groups
using the specified values.

Any comments/suggestions about the above two functions?

Thanks,
Yegappan
Reply all
Reply to author
Forward
0 new messages