Skip to main content
Module

x/denops_std/function/mod.ts>setline

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

Set line {lnum} of the current buffer to {text}. To insert lines use |append()|. To set lines in another buffer use |setbufline()|.

{lnum} is used like with |getline()|. When {lnum} is just below the last line the {text} will be added as a new line.

If this succeeds, 0 is returned. If this fails (most likely because {lnum} is invalid) 1 is returned.

Example: :call setline(5, strftime("%c"))

When {text} is a |List| then line {lnum} and following lines will be set to the items in the list. Example: :call setline(5, ['aaa', 'bbb', 'ccc']) This is equivalent to: :for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']] : call setline(n, l) :endfor

Note: The '[ and '] marks are not set.

Parameters

denops: Denops
lnum: string | number
text: string | string[]

Returns

Promise<boolean>