Skip to main content
Module

x/denops_std/function/vim/mod.ts>hlset

📚 Standard module for denops.vim
Go to Latest
function hlset
import { hlset } from "https://deno.land/x/denops_std@v6.4.0/function/vim/mod.ts";

Creates or modifies the attributes of a List of highlight groups. Each item in {list} is a dictionary containing the attributes of a highlight group. See hlget() for the list of supported items in this dictionary.

In addition to the items described in hlget(), the following additional items are supported in the dictionary:

    force           boolean flag to force the creation of
                    a link for an existing highlight group
                    with attributes.

The highlight group is identified using the 'name' item and the 'id' item (if supplied) is ignored. If a highlight group with a specified name doesn't exist, then it is created. Otherwise the attributes of an existing highlight group are modified.

If an empty dictionary value is used for the 'term' or 'cterm' or 'gui' entries, then the corresponding attributes are cleared. If the 'cleared' item is set to v:true, then all the attributes of the highlight group are cleared.

The 'linksto' item can be used to link a highlight group to another highlight group. See :highlight-link.

Returns zero for success, -1 for failure.

Example(s):

" add bold attribute to the Visual highlight group
:call hlset([#{name: 'Visual',
                \ term: #{reverse: 1 , bold: 1}}])
:call hlset([#{name: 'Type', guifg: 'DarkGreen'}])
:let l = hlget()
:call hlset(l)
" clear the Search highlight group
:call hlset([#{name: 'Search', cleared: v:true}])
" clear the 'term' attributes for a highlight group
:call hlset([#{name: 'Title', term: {}}])
" create the MyHlg group linking it to DiffAdd
:call hlset([#{name: 'MyHlg', linksto: 'DiffAdd'}])
" remove the MyHlg group link
:call hlset([#{name: 'MyHlg', linksto: 'NONE'}])
" clear the attributes and a link
:call hlset([#{name: 'MyHlg', cleared: v:true,
                \ linksto: 'NONE'}])

Can also be used as a method:

GetAttrList()->hlset()

Parameters

denops: Denops
list: unknown

Returns

Promise<number>