Skip to main content
Module

x/denops_std/function/common.ts>getline

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

Without {end} the result is a String, which is line {lnum} from the current buffer. Example:

getline(1)

When {lnum} is a String that doesn't start with a digit, line() is called to translate the String into a Number. To get the line under the cursor:

getline(".")

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

When {end} is given the result is a List where each item is a line from the current buffer in the range {lnum} to {end}, including line {end}. {end} is used in the same way as {lnum}. Non-existing lines are silently omitted. When {end} is before {lnum} an empty List is returned. Example:

:let start = line('.')
:let end = search("^$") - 1
:let lines = getline(start, end)

Can also be used as a method:

ComputeLnum()->getline()

To get lines from another buffer see getbufline() and getbufoneline()

Parameters

denops: Denops
lnum: string | number

Returns

Promise<string>

Parameters

denops: Denops
lnum: string | number
end: string | number

Returns

Promise<string[]>