Skip to main content
Module

x/denops_std/buffer/mod.ts>concrete

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

Concrete the buffer.

  • The buftype option become "nofile"
  • The swapfile become disabled
  • The modifiable become disabled
  • The content of the buffer is restored on BufReadCmd synchronously

Vim will discard the content of a non-file buffer when :edit is invoked. Use this function to concrete the content of such buffer to prevent this discard.

import { Denops } from "../mod.ts";
import * as fn from "../function/mod.ts";
import { concrete, 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;
  await fn.setbufvar(denops, bufnr, "&buftype", "nofile");
  await replace(denops, bufnr, ["Hello", "World"]);
  await concrete(denops, bufnr);
}

Then :edit on the buffer won't discard the content.

Parameters

denops: Denops
bufnr: number

Returns

Promise<void>