Skip to main content
Module

x/denops_std/buffer/decoration.ts>decorate

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

Decorate the specified buffer with decorations

import { Denops } from "../mod.ts";
import * as fn from "../function/mod.ts";
import { decorate, open } 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",
    },
  ]);
}

It uses prop_add_list in Vim and nvim_buf_add_highlight in Neovim to decorate the buffer.

Parameters

denops: Denops
bufnr: number
decorations: Decoration[]

Returns

Promise<void>