Skip to main content
Module

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

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

Sets (replaces) a line-range in the buffer.

Indexing is zero-based, end-exclusive. Negative indices are interpreted as length+1+index: -1 refers to the index past the end. So to change or delete the last element use start=-2 and end=-1.

To insert lines at a given index, set start and end to the same index. To delete a range of lines, set replacement to an empty array.

Out-of-bounds indices are clamped to the nearest valid value, unless strict_indexing is set.

Attributes: not allowed when textlock is active

Parameters:

  • {buffer} Buffer handle, or 0 for current buffer
  • {start} First line index
  • {end} Last line index, exclusive
  • {strict_indexing} Whether out-of-bounds should be an error.
  • {replacement} Array of lines to use as replacement

See also:

  • nvim_buf_set_text()

Parameters

denops: Denops
buffer: unknown
start: unknown
end: unknown
strict_indexing: unknown
replacement: unknown

Returns

Promise<unknown>