Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/function/buffer.ts>setbufline

๐Ÿ“š Standard module for denops.vim
Go to Latest
function setbufline
import { setbufline } from "https://deno.land/x/denops_std@v5.0.2/function/buffer.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. If the List is empty then nothing is changed and zero is returned.

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>