Skip to main content
Module

x/denops_std/function/nvim/mod.ts>nvim_buf_get_offset

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

Returns the byte offset of a line (0-indexed). api-indexing

Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte. 'fileformat' and 'fileencoding' are ignored. The line index just after the last line gives the total byte-count of the buffer. A final EOL byte is counted if it would be written, see 'eol'.

Unlike line2byte(), throws error for out-of-bounds indexing. Returns -1 for unloaded buffer.

Parameters:

  • {buffer} Buffer handle, or 0 for current buffer
  • {index} Line index

Return: Integer byte offset, or -1 for unloaded buffer.

Parameters

denops: Denops
buffer: unknown
index: unknown

Returns

Promise<unknown>