import { undecorate } from "https://deno.land/x/denops_std@v6.5.0/buffer/decoration.ts";
Undecorate the specified buffer
import type { Entrypoint } from "https://deno.land/x/denops_std@v6.5.0/mod.ts";
import * as fn from "https://deno.land/x/denops_std@v6.5.0/function/mod.ts";
import { decorate, open, undecorate } from "https://deno.land/x/denops_std@v6.5.0/buffer/mod.ts";
export const main: Entrypoint = async (denops) => {
await open(denops, "README.md");
const bufnr = (await fn.bufnr(denops)) as number;
// ...
await decorate(denops, bufnr, [
{
line: 1,
column: 1,
length: 10,
highlight: "Special",
},
{
line: 2,
column: 2,
length: 3,
highlight: "Comment",
},
]);
// Do something
// Ranges are 0-based and exclusive.
// Remove only the first highlight.
const start = 0;
const end = 1;
await undecorate(denops, bufnr, start, end);
// Start and end are optional. Defaults are 0 and -1 (entire buffer).
// await undecorate(denops, bufnr);
}
It uses prop_add
in Vim and nvim_buf_add_highlight
in Neovim to decorate the
buffer.