Skip to main content
Module

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

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

Sets (replaces) a range in the buffer

This is recommended over nvim_buf_set_lines() when only modifying parts of a line, as extmarks will be preserved on non-modified parts of the touched lines.

Indexing is zero-based. Row indices are end-inclusive, and column indices are end-exclusive.

To insert text at a given (row, column) location, use start_row = end_row = row and start_col = end_col = col. To delete the text in a range, use replacement = {}.

Prefer nvim_buf_set_lines() if you are only adding or deleting entire lines.

Parameters:

  • {buffer} Buffer handle, or 0 for current buffer
  • {start_row} First line index
  • {start_col} Starting column (byte offset) on first line
  • {end_row} Last line index, inclusive
  • {end_col} Ending column (byte offset) on last line, exclusive
  • {replacement} Array of lines to use as replacement

See also:

  • nvim_buf_set_lines()

Parameters

denops: Denops
buffer: unknown
start_row: unknown
start_col: unknown
end_row: unknown
end_col: unknown
replacement: unknown

Returns

Promise<unknown>