Module colorizer.buffer
Provides highlighting functions for buffer
Functions
reset_cache () | Clean the highlight cache |
add_highlight (bufnr, ns_id, line_start, line_end, data, ud_opts, hl_opts) | Create highlight and set highlights |
highlight (bufnr, ns_id, line_start, line_end, ud_opts, buf_local_opts) | Highlight the buffer region. |
parse_lines (bufnr, lines, line_start, ud_opts) | Parse the given lines for colors and return a table containing rgb_hex and range per line |
Functions
- reset_cache ()
- Clean the highlight cache
- add_highlight (bufnr, ns_id, line_start, line_end, data, ud_opts, hl_opts)
-
Create highlight and set highlights
Parameters:
- bufnr number: Buffer number (0 for current)
- ns_id number: Namespace id for which to create highlights
- line_start number: Line_start should be 0-indexed
- line_end number: Last line to highlight
- data table: Table output of `parse_lines`
- ud_opts table: `user_default_options`
- hl_opts table|nil: Highlight options: - tailwind_lsp boolean: Clear tailwind_names namespace when applying Tailwind LSP highlighting
- highlight (bufnr, ns_id, line_start, line_end, ud_opts, buf_local_opts)
-
Highlight the buffer region.
Highlight starting from `line_start` (0-indexed) for each line described by `lines` in the
buffer id `bufnr` and attach it to the namespace id `ns_id`.
Parameters:
- bufnr number: Buffer number, 0 for current
- ns_id number: Namespace id, default is "colorizer" created with vim.api.nvim_create_namespace
- line_start number: line_start should be 0-indexed
- line_end number: Last line to highlight
- ud_opts table: `user_default_options`
- buf_local_opts table: Buffer local options
Returns:
-
table: Detach settings table to use when cleaning up buffer state in `colorizer.detach_from_buffer`
- ns_id number: Table of namespace ids to clear
- functions function: Table of detach functions to call
- parse_lines (bufnr, lines, line_start, ud_opts)
-
Parse the given lines for colors and return a table containing
rgb_hex and range per line
Parameters:
- bufnr number: Buffer number (0 for current)
- lines table: Table of lines to parse
- line_start number: Buffer line number to start highlighting
- ud_opts table: `user_default_options`
Returns:
-
table|nil