Module colorizer.buffer
Provides highlighting functions for buffer
clear_hl_cache () |
Clean the highlight cache |
add_highlight (bufnr, ns_id, line_start, line_end, data, options) |
Create highlight and set highlights |
highlight (bufnr, ns_id, line_start, line_end, options, options_local) |
Highlight the buffer region. |
parse_lines (bufnr, lines, line_start, options) |
Parse the given lines for colors and return a table containing
rgb_hex and range per line |
default_namespace |
Default namespace used in `highlight` and `colorizer.attach_to_buffer`. |
-
clear_hl_cache ()
-
Clean the highlight cache
-
add_highlight (bufnr, ns_id, line_start, line_end, data, options)
-
Create highlight and set highlights
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
- data
table: table output of `parse_lines`
- options
table: Passed in setup, mainly for `user_default_options`
-
highlight (bufnr, ns_id, line_start, line_end, options, options_local)
-
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
- options
table: Configuration options as described in `setup`
- options_local
table: Buffer local variables
Returns:
table
-
parse_lines (bufnr, lines, line_start, options)
-
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: This is the buffer line number, from where to start highlighting
- options
table: Passed in `colorizer.setup`, Only uses `user_default_options`
Returns:
table|nil
-
highlight_mode_names
-
Highlight mode which will be use to render the color
Fields:
- background
- foreground
- virtualtext
-
default_namespace
-
Default namespace used in `highlight` and `colorizer.attach_to_buffer`.
See also: