Skip to main content
Module

x/denops_std/buffer/buffer.ts>replace

📚 Standard module for denops.vim
Go to Latest
function replace
import { replace } from "https://deno.land/x/denops_std@v5.0.2/buffer/buffer.ts";

Replace the content of the bufnr buffer

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

Parameters

denops: Denops
bufnr: number
repl: string[]
optional
options: ReplaceOptions = [UNSUPPORTED]

Returns

Promise<void>