Module colorizer.buffer_utils
Helper functions to highlight buffer smartly
-
clear_hl_cache ()
-
Clean the highlight cache
-
highlight_buffer (buf, ns, lines, 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 buf
and attach it to the namespace ns
.
Parameters:
- buf
number: buffer id
- ns
number: The namespace id. Default is DEFAULT_NAMESPACE. Create it with
vim.api.create_namespace
- lines
table: the lines to highlight from the buffer.
- 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:
nil|boolean|number,function|nil
-
rehighlight_buffer (buf, options, options_local, use_local_lines)
-
Rehighlight the buffer if colorizer is active
Parameters:
- buf
number: Buffer number
- options
table: Buffer options
- options_local
table|nil: Buffer local variables
- use_local_lines
boolean|nil Whether to use lines num range from options_local
Returns:
nil|boolean|number,function|nil
-
HIGHLIGHT_MODE_NAMES
-
Highlight mode which will be use to render the colour
Fields:
- background
- foreground
- virtualtext
-
DEFAULT_NAMESPACE
-
Default namespace used in highlight_buffer and colorizer.attach_to_buffer.
See also: