Module colorizer

Highlights terminal CSI ANSI color codes.

Functions

highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options) Highlight the buffer region.
attach_to_buffer ([buf=0|nil[, options]]) Attach to a buffer and continuously highlight changes.
detach_from_buffer ([buf=0|nil[, ns=DEFAULT_NAMESPACE]]) Stop highlighting the current buffer.
setup ([filetypes={'*'}[, default_options]]) Easy to use function if you want the full setup without fine grained control.
reload_all_buffers () Reload all of the currently active highlighted buffers.
get_buffer_options ([buf=0|nil]) Return the currently active buffer options.

Fields

DEFAULT_NAMESPACE Default namespace used in `highlight_buffer` and `attach_to_buffer`.


Functions

highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options)
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 integer buffer id.
  • ns integer the namespace id. Create it with `vim.api.create_namespace` (default DEFAULT_NAMESPACE)
  • lines {string,...} the lines to highlight from the buffer.
  • line_start integer should be 0-indexed
  • options Configuration options as described in `setup`

See also:

attach_to_buffer ([buf=0|nil[, options]])
Attach to a buffer and continuously highlight changes.

Parameters:

  • buf integer A value of 0 implies the current buffer. (default 0|nil)
  • options Configuration options as described in `setup` (optional)

See also:

detach_from_buffer ([buf=0|nil[, ns=DEFAULT_NAMESPACE]])
Stop highlighting the current buffer.

Parameters:

  • buf integer A value of 0 or nil implies the current buffer. (default 0|nil)
  • ns integer the namespace id. (default DEFAULT_NAMESPACE)
setup ([filetypes={'*'}[, default_options]])
Easy to use function if you want the full setup without fine grained control. Setup an autocmd which enables colorizing for the filetypes and options specified.

By default highlights all FileTypes.

Example config: ``` { 'scss', 'html', css = { rgb_fn = true; }, javascript = { no_names = true } } ```

You can combine an array and more specific options. Possible options: - `no_names`: Don't highlight names like Blue - `rgb_fn`: Highlight `rgb(...)` functions. - `mode`: Highlight mode. Valid options: `foreground`,`background`

Parameters:

  • filetypes A table/array of filetypes to selectively enable and/or customize. By default, enables all filetypes. (default {'*'})
  • default_options {[string]=string} Default options to apply for the filetypes enable. (optional)

Usage:

    require'colorizer'.setup()
reload_all_buffers ()
Reload all of the currently active highlighted buffers.
get_buffer_options ([buf=0|nil])
Return the currently active buffer options.

Parameters:

  • buf integer A value of 0 or nil implies the current buffer. (default 0|nil)

Fields

DEFAULT_NAMESPACE
Default namespace used in `highlight_buffer` and `attach_to_buffer`. The name is "terminal_highlight"

See also:

generated by LDoc 1.4.6 Last updated 2019-10-18 09:40:19