Skip to main content
Module

x/denops_std/function/mod.ts>setbufline

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

Set line {lnum} to {text} in buffer {buf}. This works like setline() for the specified buffer.

This function works only for loaded buffers. First call bufload() if needed.

To insert lines use appendbufline(). Any text properties in {lnum} are cleared.

{text} can be a string to set one line, or a list of strings to set multiple lines. If the list extends below the last line then those lines are added.

For the use of {buf}, see bufname() above.

{lnum} is used like with setline(). Use "$" to refer to the last line in buffer {buf}. When {lnum} is just below the last line the {text} will be added below the last line.

When {buf} is not a valid buffer, the buffer is not loaded or {lnum} is not valid then 1 is returned. In Vim9 script an error is given. On success 0 is returned.

Can also be used as a method, the base is passed as the third argument:

GetText()->setbufline(buf, lnum)

Parameters

denops: Denops
text: string | string[]

Returns

Promise<boolean>