Write buffer lines
nvim_write_bufferReplace a line range in an open Neovim buffer with new lines. Use zero-based start and end indices; set start=0 and end=-1 to overwrite the entire buffer.
Instructions
Replace a line range in a buffer with new lines. Line range is 0-based and end-exclusive; use start = 0, end = -1 to replace the whole buffer.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | End line (0-based, exclusive). Default -1 (replace to end). | |
| path | No | Target buffer by file path (must already be open). Ignored if bufnr is set. | |
| bufnr | No | Target buffer number. Omit to use the path or the current buffer. | |
| lines | Yes | Replacement lines (no trailing newlines). | |
| start | No | First line to replace (0-based). Default 0. |