Module colorizer.buffer

Helper functions to highlight buffer smartly

Functions

clear_hl_cache () Clean the highlight cache
add_highlight (buf, ns, line_start, line_end, data, options) Create highlight and set highlights
highlight (buf, ns, line_start, line_end, options, options_local) Highlight the buffer region.
parse_lines (buf, lines, line_start, options) Parse the given lines for colors and return a table containing rgb_hex and range per line
rehighlight (buf, options, options_local, use_local_lines) Rehighlight the buffer if colorizer is active

Tables

highlight_mode_names Highlight mode which will be use to render the colour

Fields

default_namespace Default namespace used in highlight and colorizer.attach_to_buffer.


Functions

clear_hl_cache ()
Clean the highlight cache
add_highlight (buf, ns, line_start, line_end, data, options)
Create highlight and set highlights

Parameters:

  • buf number
  • ns number
  • line_start number
  • line_end number
  • data table: table output of parse_lines
  • options table: Passed in setup, mainly for user_default_options
highlight (buf, ns, 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.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:

    nil|boolean|number,table
parse_lines (buf, lines, line_start, options)
Parse the given lines for colors and return a table containing rgb_hex and range per line

Parameters:

  • buf number
  • lines table
  • 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
rehighlight (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,table

Tables

highlight_mode_names
Highlight mode which will be use to render the colour

Fields:

  • background
  • foreground
  • virtualtext

Fields

default_namespace
Default namespace used in highlight and colorizer.attach_to_buffer.

See also:

generated by LDoc 1.4.6 Last updated - February