Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/function/nvim/mod.ts>nvim_buf_add_highlight

๐Ÿ“š Standard module for denops.vim
Go to Latest
function nvim_buf_add_highlight
import { nvim_buf_add_highlight } from "https://deno.land/x/denops_std@v3.9.0/function/nvim/mod.ts";

Adds a highlight to buffer. Useful for plugins that dynamically generate highlights to a buffer (like a semantic highlighter or linter). The function adds a single highlight to a buffer. Unlike |matchaddpos()| highlights follow changes to line numbering (as lines are inserted/removed above the highlighted line), like signs and marks do. Namespaces are used for batch deletion/updating of a set of highlights. To create a namespace, use |nvim_create_namespace()| which returns a namespace id. Pass it in to this function as ns_id to add highlights to the namespace. All highlights in the same namespace can then be cleared with single call to |nvim_buf_clear_namespace()|. If the highlight never will be deleted by an API call, pass ns_id = -1 . As a shorthand, ns_id = 0 can be used to create a new namespace for the highlight, the allocated id is then returned. If hl_group is the empty string no highlight is added, but a new ns_id is still returned. This is supported for backwards compatibility, new code should use |nvim_create_namespace()| to create a new empty namespace. Parameters: ~ {buffer} Buffer handle, or 0 for current buffer {ns_id} namespace to use or -1 for ungrouped highlight {hl_group} Name of the highlight group to use {line} Line to highlight (zero-indexed) {col_start} Start of (byte-indexed) column range to highlight {col_end} End of (byte-indexed) column range to highlight, or -1 to highlight to end of line Return: ~ The ns_id that was used

Parameters

denops: Denops
buffer: unknown
ns_id: unknown
hl_group: unknown
line: unknown
col_start: unknown
col_end: unknown

Returns

Promise<unknown>