Skip to main content
Module

x/denops_std/function/mod.ts>getbufline

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

Return a List with the lines starting from {lnum} to {end} (inclusive) in the buffer {buf}. If {end} is omitted, a List with only the line {lnum} is returned. See getbufoneline() for only getting the line.

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

For {lnum} and {end} "$" can be used for the last line of the buffer. Otherwise a number must be used.

When {lnum} is smaller than 1 or bigger than the number of lines in the buffer, an empty List is returned.

When {end} is greater than the number of lines in the buffer, it is treated as {end} is set to the number of lines in the buffer. When {end} is before {lnum} an empty List is returned.

This function works only for loaded buffers. For unloaded and non-existing buffers, an empty List is returned.

Example:

:let lines = getbufline(bufnr("myfile"), 1, "$")

Can also be used as a method:

GetBufnr()->getbufline(lnum)

Parameters

denops: Denops
optional
end: BufLnumArg

Returns

Promise<string[]>