From 28b41de2f491ef598197823c04fc7e86ae76a625 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 28 Aug 2022 12:30:35 +0530 Subject: fragment | Implement better autocmd management | refactor add a all_buffers option - colorizer will activate on all buffers, empty or not, still respect filetypes option handle errors when detach is called multiple times from the same buffer use bufdelete and bufdelete to remove the autocmds use a more efficient compile parse_fn function use custom ldoc template to generate vim help --- doc/modules/colorizer.html | 293 ++++++++++++++++++++++++++++++--------------- 1 file changed, 196 insertions(+), 97 deletions(-) (limited to 'doc/modules/colorizer.html') diff --git a/doc/modules/colorizer.html b/doc/modules/colorizer.html index e02d18a..3db15a7 100644 --- a/doc/modules/colorizer.html +++ b/doc/modules/colorizer.html @@ -3,7 +3,7 @@ - Reference + colorizer Docs @@ -24,7 +24,7 @@ @@ -49,42 +52,114 @@

Module colorizer

+

Requires Neovim >= 0.6.0 and set termguicolors

Highlights terminal CSI ANSI color codes.

-

+

See also:

+ +

Usage:

+ +

Info:

+

Functions

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

Fields

- +
DEFAULT_NAMESPACEDefault namespace used in `highlight_buffer` and `attach_to_buffer`.Default namespace used in colorizer.buffer_utils.highlight_buffer and attach_to_buffer.
@@ -97,97 +172,92 @@
- highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options) + highlight_buffer ()
- 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`. + Highlight the buffer region + + +

See also:

+ + + +
+
+ + is_buffer_attached (buf) +
+
+ Check if attached to a buffer. + +

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` + number|nil: A value of 0 implies the current buffer.
+

Returns:

+
    + + number|nil: if attached to the buffer, false otherwise. +

See also:

- - attach_to_buffer ([buf=0|nil[, options]]) + + detach_from_buffer (buf, ns)
- Attach to a buffer and continuously highlight changes. + Stop highlighting the current buffer.

Parameters:

  • buf - integer - A value of 0 implies the current buffer. - (default 0|nil) + number|nil: buf A value of 0 or nil implies the current buffer.
  • -
  • options - Configuration options as described in `setup` - (optional) +
  • ns + number|nil: ns the namespace id, if not given DEFAULT_NAMESPACE is used
-

See also:

-
- - detach_from_buffer ([buf=0|nil[, ns=DEFAULT_NAMESPACE]]) + + attach_to_buffer (buf, options, typ)
- Stop highlighting the current buffer. + Attach to a buffer and continuously highlight changes.

Parameters:

  • buf - integer - A value of 0 or nil implies the current buffer. - (default 0|nil) + integer: A value of 0 implies the current buffer.
  • -
  • ns - integer - the namespace id. - (default DEFAULT_NAMESPACE) +
  • options + table: Configuration options as described in setup +
  • +
  • typ + string|nil: "buf" or "file" - The type of buffer option
@@ -198,34 +268,52 @@ buffer `buf` and attach it to the namespace `ns`.
- setup ([filetypes={'*'}[, default_options]]) + setup (config)
- 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` + +

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:~

+ +
+  { filetypes = { "css", "html" }, user_default_options = { names = true } }
+
+ +

Setup with all the default options:~

+ +
+    require("colorizer").setup {
+      filetypes = { "*" },
+      user_default_options = {
+        RGB = true, -- #RGB hex codes
+        RRGGBB = true, -- #RRGGBB hex codes
+        names = true, -- "Name" codes like Blue or blue
+        RRGGBBAA = false, -- #RRGGBBAA hex codes
+        AARRGGBB = false, -- 0xAARRGGBB hex codes
+        rgb_fn = false, -- CSS rgb() and rgba() functions
+        hsl_fn = false, -- CSS hsl() and hsla() functions
+        css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
+        css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
+        -- Available modes for mode: foreground, background,  virtualtext
+        mode = "background", -- Set the display mode.
+        virtualtext = "■",
+      },
+      -- all the sub-options of filetypes apply to buftypes
+      buftypes = {},
+    }
+
+

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) +
  • config + table: Config containing above parameters.
@@ -234,9 +322,29 @@ buffer `buf` and attach it to the namespace `ns`.

Usage:

    -
    require'colorizer'.setup()
    +
    require'colorizer'.setup()
+
+
+ + get_buffer_options (buf) +
+
+ Return the currently active buffer options. + + +

Parameters:

+
    +
  • buf + number|nil: Buffer number +
  • +
+ + + + +
@@ -253,21 +361,13 @@ buffer `buf` and attach it to the namespace `ns`.
- - get_buffer_options ([buf=0|nil]) + + clear_highlight_cache ()
- Return the currently active buffer options. + Clear the highlight cache and reload all buffers. -

Parameters:

-
    -
  • buf - integer - A value of 0 or nil implies the current buffer. - (default 0|nil) -
  • -
@@ -283,8 +383,7 @@ buffer `buf` and attach it to the namespace `ns`. DEFAULT_NAMESPACE
- Default namespace used in `highlight_buffer` and `attach_to_buffer`. - The name is "terminal_highlight" + Default namespace used in colorizer.buffer_utils.highlight_buffer and attach_to_buffer. @@ -292,7 +391,7 @@ buffer `buf` and attach it to the namespace `ns`.

See also:

@@ -305,7 +404,7 @@ buffer `buf` and attach it to the namespace `ns`.
generated by LDoc 1.4.6 -Last updated 2019-10-18 09:40:19 +Last updated 2022-09-03 17:24:13
-- cgit v1.2.3-70-g09d2