Use NuiText to manage text and highlights
mainNuiText is an abstraction layer over Neovim's native nvim_buf_set_text and nvim_buf_set_extmark functions. It simplifies setting text content and applying highlights to specific buffer locations.
Initialization
You can create a NuiText object using the following signature:
NuiText(content, extmark?)
content: Astringortablecontaining the text content. If aNuiTextobject is passed, a copy is created.extmark: Defines the highlight.- If a
stringis passed, it is treated as the highlight group name. - If a
tableis passed, it is treated as extmark options. It supports the key"hl_group"for the highlight group name.
- If a
Rendering to a Buffer
To actually place the text in a buffer, use the render or render_char methods.