highlight_range
Highlight a range of lines in a Neovim buffer with a specified color. Visual annotation only, does not modify buffer content. Specify file, start and end lines, and optional color.
Instructions
Add a colored line highlight to a Neovim buffer. This is a visual annotation only — it does not modify buffer content and is not persisted to disk. Highlights stack; calling this multiple times adds more highlights without removing previous ones.
file: path relative to Neovim's cwd (as shown in get_state buffers).
The buffer must already be open in Neovim; returns an error otherwise.
start_line: first line to highlight (1-indexed, inclusive).
end_line: last line to highlight (1-indexed, inclusive). Out-of-range
values are clamped. If start_line > end_line they are swapped.
color: any hex color (e.g. "#3b4048") or Neovim color name
(e.g. "DarkGreen"). Defaults to "#3b4048".
Use this for a single highlight. Use highlight_ranges to apply
multiple highlights in one call. Use clear_highlights to remove
all highlights from a buffer.
Returns {highlighted} with the number of lines highlighted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | ||
| start_line | Yes | ||
| end_line | Yes | ||
| color | No | #3b4048 |