import { ensure } from "https://deno.land/x/denops_std@v6.5.1/buffer/buffer.ts";
Ensure the executor is executed under the specified buffer
import type { Entrypoint } from "https://deno.land/x/denops_std@v6.5.1/mod.ts";
import * as option from "https://deno.land/x/denops_std@v6.5.1/option/mod.ts";
import * as fn from "https://deno.land/x/denops_std@v6.5.1/function/mod.ts";
import { ensure, open } 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);
// ...
await ensure(denops, bufnr, async () => {
await option.buftype.set(denops, "nofile");
await option.swapfile.set(denops, false);
await fn.setline(denops, 1, ["Hello", "World"]);
});
}
Note that it's better to use setbufvar
or whatever instead. It's mainly
designed to define mappings that is not possible from outside of the buffer.