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

x/ddc_vim/deps.ts>fn.line2byte

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.line2byte
import { fn } from "https://deno.land/x/ddc_vim@v3.8.0/deps.ts";
const { line2byte } = fn;

Return the byte count from the start of the buffer for line {lnum}. This includes the end-of-line character, depending on the 'fileformat' option for the current buffer. The first line returns 1. 'encoding' matters, 'fileencoding' is ignored. This can also be used to get the byte count for the line just below the last line:

line2byte(line("$") + 1)

This is the buffer size plus one. If 'fileencoding' is empty it is the file size plus one. {lnum} is used like with getline(). When {lnum} is invalid, or the +byte_offset feature has been disabled at compile time, -1 is returned. Also see byte2line(), go and :goto.

Can also be used as a method:

GetLnum()->line2byte()

Parameters

denops: Denops
lnum: number

Returns

Promise<number>