Skip to main content
Module

x/denops_std/buffer/mod.ts>undecorate

📚 Standard module for denops.vim
Go to Latest
function undecorate
import { undecorate } from "https://deno.land/x/denops_std@v4.1.4/buffer/mod.ts";

Undecorate the specified buffer

import { Denops } from "../mod.ts";
import * as fn from "../function/mod.ts";
import { decorate, open, undecorate } from "../buffer/mod.ts";

export async function main(denops: Denops): Promise<void> {
  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.

Parameters

denops: Denops
bufnr: number
optional
start = [UNSUPPORTED]
optional
end = [UNSUPPORTED]

Returns

Promise<void>