import { replace } from "https://deno.land/x/denops_std@v6.5.1/buffer/buffer.ts";
Replace the content of the bufnr
buffer
import type { Entrypoint } from "https://deno.land/x/denops_std@v6.5.1/mod.ts";
import * as fn from "https://deno.land/x/denops_std@v6.5.1/function/mod.ts";
import { open, replace } from "https://deno.land/x/denops_std@v6.5.1/buffer/mod.ts";
export const main: Entrypoint = async (denops) => {
await open(denops, "README.md");
const bufnr = await fn.bufnr(denops);
// Set the content of the `bufnr` buffer
await replace(denops, bufnr, ["Hello", "World"]);
}
It temporary change modified
, modifiable
, and foldmethod
options to
replace the content of the buffer
buffer without unmodifiable error or so on.