import * as denopsStd from "https://deno.land/x/denops_std@v6.5.1/buffer/mod.ts";
A module to provide Vim buffer utility functions
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 * as buffer from "https://deno.land/x/denops_std@v6.5.1/buffer/mod.ts";
export const main: Entrypoint = async (denops) => {
// Open `README.md`
// Same as `:edit README.md`
await buffer.open(denops, "README.md");
// Open `LICENSE` with given options
// Same as `:keepjumps keepalt edit ++enc=sjis ++ff=dos LICENSE`
await buffer.open(denops, "LICENSE", {
mods: "keepjumps keepalt",
cmdarg: "++enc=sjis ++ff=dos",
});
const bufnr = await fn.bufnr(denops);
// Append the content under the cursor position of the `bufnr` buffer
await buffer.append(denops, bufnr, ["Hello", "World"]);
// Set the content of the `bufnr` buffer
await buffer.replace(denops, bufnr, ["Hello", "World"]);
// 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
await buffer.concrete(denops, bufnr);
// Decorate the specified buffer with decorations
await buffer.decorate(denops, bufnr, [
{
line: 1,
column: 1,
length: 10,
highlight: "Special",
},
{
line: 2,
column: 2,
length: 3,
highlight: "Comment",
},
]);
}
Variables
Assert that the value is FileFormat. | |
Ensure that the value is FileFormat. | |
Predicate that the value is FileFormat. | |
Maybe that the value is FileFormat. |
Functions
Append content under the current cursor position or given lnum of the buffer | |
Concrete the buffer. | |
Decode raw binary content for string array for the | |
Decorate the specified buffer with decorations | |
Ensure the executor is executed under the specified buffer | |
Ensure the executor is executed under a modifiable buffer | |
f open | Open a |
Reload the content of the | |
Replace the content of the | |
Undecorate the specified buffer |