Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.setbufline

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.setbufline
import { fn } from "https://deno.land/x/ddc_vim@v4.0.2/deps.ts";
const { setbufline } = fn;

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>