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/colorizer-lua.txt | 162 ----------- doc/colorizer.txt | 465 +++++++++++++++++++++++++++++++ doc/index.html | 36 ++- doc/ldoc.css | 453 ++++++++++++++++-------------- doc/ldoc_vim.ltp | 230 +++++++++++++++ doc/modules/colorizer.buffer_utils.html | 222 +++++++++++++++ doc/modules/colorizer.color_utils.html | 355 +++++++++++++++++++++++ doc/modules/colorizer.html | 293 ++++++++++++------- doc/modules/colorizer.matcher_utils.html | 113 ++++++++ doc/modules/colorizer.trie.html | 69 +++++ doc/modules/colorizer.utils.html | 87 ++++++ doc/modules/nvim.html | 66 ----- doc/modules/trie.html | 27 +- doc/modules/utils.html | 231 +++++++++++++++ doc/tags | 37 +++ 15 files changed, 2289 insertions(+), 557 deletions(-) delete mode 100644 doc/colorizer-lua.txt create mode 100644 doc/colorizer.txt create mode 100644 doc/ldoc_vim.ltp create mode 100644 doc/modules/colorizer.buffer_utils.html create mode 100644 doc/modules/colorizer.color_utils.html create mode 100644 doc/modules/colorizer.matcher_utils.html create mode 100644 doc/modules/colorizer.trie.html create mode 100644 doc/modules/colorizer.utils.html delete mode 100644 doc/modules/nvim.html create mode 100644 doc/modules/utils.html create mode 100644 doc/tags (limited to 'doc') diff --git a/doc/colorizer-lua.txt b/doc/colorizer-lua.txt deleted file mode 100644 index 84db37f..0000000 --- a/doc/colorizer-lua.txt +++ /dev/null @@ -1,162 +0,0 @@ -*colorizer.lua* Highlight color codes like #RRGGBB and others. - -Minimum version of neovim: 0.4.0 - -Author: Ashkan Kiani - -============================================================================== -INTRODUCTION *colorizer-lua-introduction* - -============================================================================== -QUICK START *colorizer-lua-quickstart* - -Establish the an autocmd to highlight all filetypes. -> - lua require 'colorizer'.setup() - - " Highlight using all available possible highlight modes in every filetype - lua require 'colorizer'.setup(nil, { css = true; }) -< - -============================================================================== -COMMANDS *colorizer-commands* - -|:ColorizerAttachToBuffer| *:ColorizerAttachToBuffer* - -Attach to the current buffer and start highlighting with the settings as -specified in setup (or the defaults). - -If the buffer was already attached (i.e. being highlighted), the settings will -be reloaded with the ones from setup. This is useful for reloading settings -for just one buffer. - - -|:ColorizerDetachFromBuffer| *:ColorizerDetachFromBuffer* - -Stop highlighting the current buffer (detach). - -|:ColorizerReloadAllBuffers| *:ColorizerReloadAllBuffers* - -Reload all buffers that are being highlighted with new settings from the setup -settings (or the defaults). Shortcut for ColorizerAttachToBuffer on every -buffer. - -:ColorizerToggle :ColorizerToggle - -Toggle highlighting of the current buffer. - -============================================================================== -LUA API DEFINITION *colorizer-lua-api* - -Assumes the module is imported as `colorizer` - -|colorizer-options| *colorizer-options* - -> - DEFAULT_OPTIONS = { - RGB = true; -- #RGB hex codes - RRGGBB = true; -- #RRGGBB hex codes - names = true; -- "Name" codes like Blue - RRGGBBAA = false; -- #RRGGBBAA 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: foreground, background - mode = 'background'; -- Set the display mode. - virtualtext = '■'; -- the virtual text block - } -< - -MODES: -- 'foreground': sets the foreground text color. -- 'background': sets the background text color. -- 'virtualtext': indicate the color behind the virtualtext - - -|colorizer.setup| *colorizer.setup* - -Easy to use function if you want the full setup without fine grained control. -Establishes an autocmd for `FileType`s . - -PARAMETERS: - `filetypes` (optional) filetypes to enable. see examples below - `default_options` (optional) |colorizer-options| -> - colorizer.setup([filetypes=nil], [default_options={}]) - - " In your VIMRC - lua require'colorizer'.setup() - - -- From lua - -- Attaches to every FileType mode - require 'colorizer'.setup() - - -- Attach to certain Filetypes, add special configuration for `html` - -- Use `background` for everything else. - require 'colorizer'.setup { - 'css'; - 'javascript'; - html = { - mode = 'foreground'; - } - } - - -- Use the `default_options` as the second parameter, which uses - -- `foreground` for every mode. This is the inverse of the previous - -- setup configuration. - require 'colorizer'.setup({ - 'css'; - 'javascript'; - html = { mode = 'background' }; - }, { mode = 'foreground' }) - - -- Use the `default_options` as the second parameter, which uses - -- `foreground` for every mode. This is the inverse of the previous - -- setup configuration. - require 'colorizer'.setup { - '*'; -- Highlight all files, but customize some others. - css = { rgb_fn = true; }; -- Enable parsing rgb(...) functions in css. - html = { names = false; } -- Disable parsing "names" like Blue or Gray - } - - -- Exclude some filetypes from highlighting by using `!` - require 'colorizer'.setup { - '*'; -- Highlight all files, but customize some others. - '!vim'; -- Exclude vim from highlighting. - -- Exclusion Only makes sense if '*' is specified! - } -< - -|colorizer.highlight_buffer| *colorizer.highlight_buffer* - -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` buffer id. - `ns` the namespace id. Create it with `vim.api.create_namespace` - `lines` the lines to highlight from the buffer. - `line_start` should be 0-indexed - `options` |colorizer-options| to set. REQUIRED! -> - colorizer.highlight_buffer(buf[, ns=DEFAULT_NAMESPACE], - lines, line_start, options) -< - -|colorizer.attach_to_buffer| *colorizer.attach_to_buffer* - -Attach to a buffer and continuously highlight changes. - -If you don't specify `options`, it will be set from the setup options if -specified or the default in |colorizer-options|. - -PARAMETERS: - `buf` A value of 0 implies the current buffer. - `options` (optional) |colorizer-options| to set. -> - colorizer.attach_to_buffer(buf[, options={}]) -< - - vim:tw=78:ts=8:noet:ft=help:norl: - diff --git a/doc/colorizer.txt b/doc/colorizer.txt new file mode 100644 index 0000000..1480756 --- /dev/null +++ b/doc/colorizer.txt @@ -0,0 +1,465 @@ +*colorizer* Requires Neovim >= 0.6.0 and `set termguicolors` + +Highlights terminal CSI ANSI color codes. + +Author: Ashkan Kiani + +============================================================================== +USAGE *colorizer-usage* + + Establish the autocmd to highlight all filetypes. + + `lua require 'colorizer'.setup()` + + Highlight using all css highlight modes in every filetype + + `lua require 'colorizer'.setup(user_default_options = { css = true; })` + +============================================================================== +USE WITH COMMANDS *colorizer-commands* + + *:ColorizerAttachToBuffer* + + Attach to the current buffer and start highlighting with the settings as + specified in setup (or the defaults). + + If the buffer was already attached(i.e. being highlighted), the + settings will be reloaded with the ones from setup. + This is useful for reloading settings for just one buffer. + + *:ColorizerDetachFromBuffer* + + Stop highlighting the current buffer (detach). + + *:ColorizerReloadAllBuffers* + + Reload all buffers that are being highlighted currently. + Shortcut for ColorizerAttachToBuffer on every buffer. + + *:ColorizerToggle* + Toggle highlighting of the current buffer. + +USE WITH LUA + + All options that can be passed to user_default_options in `setup` + can be passed here. Can be empty too. + `0` is the buffer number here + + Attach to current buffer > + require("colorizer").attach_to_buffer(0, { + mode = "background", + css = false, + }) +< + Detach from buffer > + require("colorizer").detach_from_buffer(0, { + mode = "background", + css = false, + }) +< + + See:~ + |colorizer.setup| + |colorizer.attach_to_buffer| + |colorizer.detach_from_buffer| + +============================================================================== +LUA API *colorizer-lua-api* + +Functions: ~ + |highlight_buffer| - Highlight the buffer region + + |is_buffer_attached| - Check if attached to a buffer. + + |detach_from_buffer| - Stop highlighting the current buffer. + + |attach_to_buffer| - Attach to a buffer and continuously highlight changes. + + |setup| - Easy to use function if you want the full setup without fine + grained control. + + |get_buffer_options| - Return the currently active buffer options. + + |reload_all_buffers| - Reload all of the currently active highlighted + buffers. + + |clear_highlight_cache| - Clear the highlight cache and reload all buffers. + +Fields: ~ + |DEFAULT_NAMESPACE| - Default namespace used in + `colorizer.buffer_utils.highlight_buffer` and `attach_to_buffer`. + + +highlight_buffer() *colorizer.highlight_buffer* + Highlight the buffer region + + See also:~ + |colorizer.buffer_utils.highlight_buffer| + + + +is_buffer_attached({buf}) *colorizer.is_buffer_attached* + Check if attached to a buffer. + + Parameters: ~ + {buf} - number|nil: A value of 0 implies the current buffer. + + returns:~ + number|nil: if attached to the buffer, false otherwise. + + See also:~ + |highlight_buffer| + + + +detach_from_buffer({buf}, {ns}) *colorizer.detach_from_buffer* + Stop highlighting the current buffer. + + Parameters: ~ + {buf} - number|nil: buf A value of 0 or nil implies the current buffer. + {ns} - number|nil: ns the namespace id, if not given DEFAULT_NAMESPACE + is used + + + +attach_to_buffer({buf}, {options}, {typ}) *colorizer.attach_to_buffer* + Attach to a buffer and continuously highlight changes. + + Parameters: ~ + {buf} - integer: A value of 0 implies the current buffer. + {options} - table: Configuration options as described in `setup` + {typ} - string|nil: "buf" or "file" - The type of buffer option + + + +setup({config}) *colorizer.setup* + 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: ~ + {config} - table: Config containing above parameters. + + Usage:~ + `require'colorizer'.setup()` + + + +get_buffer_options({buf}) *colorizer.get_buffer_options* + Return the currently active buffer options. + + Parameters: ~ + {buf} - number|nil: Buffer number + + + +reload_all_buffers() *colorizer.reload_all_buffers* + Reload all of the currently active highlighted buffers. + + + +clear_highlight_cache() *colorizer.clear_highlight_cache* + Clear the highlight cache and reload all buffers. + + + +DEFAULT_NAMESPACE *colorizer.DEFAULT_NAMESPACE* + Default namespace used in `colorizer.buffer_utils.highlight_buffer` and + `attach_to_buffer`. + + See also:~ + |colorizer.buffer_utils.highlight_buffer| + |attach_to_buffer| + + + +============================================================================== +BUFFER_UTILS *colorizer.buffer_utils-introduction* + +Helper functions to highlight buffer smartly + + +============================================================================== +LUA API *colorizer.buffer_utils-lua-api* + +Functions: ~ + |highlight_buffer| - Highlight the buffer region. + + |rehighlight_buffer| - 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_buffer` and + `colorizer.attach_to_buffer`. + + + + *colorizer.buffer_utils.highlight_buffer* +highlight_buffer({buf}, {ns}, {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} - 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 + {options} - table: Configuration options as described in `setup` + + + +rehighlight_buffer({buf}, {options}) *colorizer.buffer_utils.rehighlight_buffer* + Rehighlight the buffer if colorizer is active + + Parameters: ~ + {buf} - number: Buffer number + {options} - table: Buffer options + + + +HIGHLIGHT_MODE_NAMES *colorizer.buffer_utils.HIGHLIGHT_MODE_NAMES* + Highlight mode which will be use to render the colour + + Fields: ~ + {background} - + {foreground} - + {virtualtext} - + + + +DEFAULT_NAMESPACE *colorizer.buffer_utils.DEFAULT_NAMESPACE* + Default namespace used in `highlight_buffer` and + `colorizer.attach_to_buffer`. + + See also:~ + |highlight_buffer| + |colorizer.attach_to_buffer| + + + +============================================================================== +COLOR_UTILS *colorizer.color_utils-introduction* + +Helper functions to parse different colour formats + + +============================================================================== +LUA API *colorizer.color_utils-lua-api* + +Functions: ~ + |color_is_bright| - Determine whether to use black or white text. + + |color_name_parser| - Grab all the colour values from + `vim.api.nvim_get_color_map` and create a lookup table. + + |rgb_function_parser| - Parse for rgb() css function and return rgb hex. + + |rgba_function_parser| - Parse for rgba() css function and return rgb hex. + + |hsl_function_parser| - Parse for hsl() css function and return rgb hex. + + |hsla_function_parser| - Parse for hsl() css function and return rgb hex. + + |argb_hex_parser| - parse for 0xaarrggbb and return rgb hex. + + |rgba_hex_parser| - parse for #rrggbbaa and return rgb hex. + + +color_is_bright({r}, {g}, {b}) *colorizer.color_utils.color_is_bright* + Determine whether to use black or white text. + + + ref: https://stackoverflow.com/a/1855903/837964 + https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color + + + Parameters: ~ + {r} - number: Red + {g} - number: Green + {b} - number: Blue + + + +color_name_parser({line}, {i}) *colorizer.color_utils.color_name_parser* + Grab all the colour values from `vim.api.nvim_get_color_map` and create a + lookup table. + + COLOR_MAP is used to store the colour values + + + Parameters: ~ + {line} - string: Line to parse + {i} - number: Index of line from where to start parsing + + + +rgb_function_parser({line}, {i}) *colorizer.color_utils.rgb_function_parser* + Parse for rgb() css function and return rgb hex. + + Parameters: ~ + {line} - string: Line to parse + {i} - number: Index of line from where to start parsing + + returns:~ + number|nil: Index of line where the rgb function ended + string|nil: rgb hex value + + + +rgba_function_parser({line}, {i}) *colorizer.color_utils.rgba_function_parser* + Parse for rgba() css function and return rgb hex. + + Todo consider removing the regexes here + Todo this might not be the best approach to alpha channel. + Things like pumblend might be useful here. + + + Parameters: ~ + {line} - string: Line to parse + {i} - number: Index of line from where to start parsing + + returns:~ + number|nil: Index of line where the rgba function ended + string|nil: rgb hex value + + + +hsl_function_parser({line}, {i}) *colorizer.color_utils.hsl_function_parser* + Parse for hsl() css function and return rgb hex. + + Parameters: ~ + {line} - string: Line to parse + {i} - number: Index of line from where to start parsing + + returns:~ + number|nil: Index of line where the hsl function ended + string|nil: rgb hex value + + + +hsla_function_parser({line}, {i}) *colorizer.color_utils.hsla_function_parser* + Parse for hsl() css function and return rgb hex. + + Parameters: ~ + {line} - string: Line to parse + {i} - number: Index of line from where to start parsing + + returns:~ + number|nil: Index of line where the hsla function ended + string|nil: rgb hex value + + + +argb_hex_parser({line}, {i}) *colorizer.color_utils.argb_hex_parser* + parse for 0xaarrggbb and return rgb hex. + + a format used in android apps + + + Parameters: ~ + {line} - string: line to parse + {i} - number: index of line from where to start parsing + + returns:~ + number|nil: index of line where the hex value ended + string|nil: rgb hex value + + + +rgba_hex_parser({line}, {i}, {opts}) *colorizer.color_utils.rgba_hex_parser* + parse for #rrggbbaa and return rgb hex. + + a format used in android apps + + + Parameters: ~ + {line} - string: line to parse + {i} - number: index of line from where to start parsing + {opts} - table: Containing minlen, maxlen, valid_lengths + + returns:~ + number|nil: index of line where the hex value ended + string|nil: rgb hex value + + + +============================================================================== +MATCHER_UTILS *colorizer.matcher_utils-introduction* + +Helper functions for colorizer to enable required parsers + + +============================================================================== +LUA API *colorizer.matcher_utils-lua-api* + +Functions: ~ + |make_matcher| - Parse the given options and return a function with enabled + parsers. + + +make_matcher({options}) *colorizer.matcher_utils.make_matcher* + Parse the given options and return a function with enabled parsers. + + if no parsers enabled then return false + Do not try make the function again if it is present in the cache + + + Parameters: ~ + {options} - table: options created in `colorizer.setup` + + returns:~ + function|boolean: function which will just parse the line for enabled + parsers + + + +============================================================================== +TRIE *colorizer.trie-introduction* + +Trie implementation in luajit. + +todo: write documentation + + +vim:tw=80:ts=8:noet:ft=help:norl: diff --git a/doc/index.html b/doc/index.html index fdeae17..ae0a8d2 100644 --- a/doc/index.html +++ b/doc/index.html @@ -3,7 +3,7 @@ - Reference + colorizer Docs @@ -24,7 +24,7 @@ @@ -46,16 +49,27 @@ - + - - + + - - + + + + + + + + + + + + + +
colorizerHighlights terminal CSI ANSI color codes.Requires Neovim >= 0.6.0 and set termguicolors
nvimModule of magic functions for nvimcolorizer.buffer_utilsHelper functions to highlight buffer smartly
trieTrie implementation in luajit - Copyright © 2019 Ashkan Kianicolorizer.color_utilsHelper functions to parse different colour formats
colorizer.matcher_utilsHelper functions for colorizer to enable required parsers
colorizer.trieTrie implementation in luajit.
utilsHelper utils
@@ -63,7 +77,7 @@
generated by LDoc 1.4.6 -Last updated 2019-10-18 09:40:19 +Last updated 2022-09-03 17:24:13
diff --git a/doc/ldoc.css b/doc/ldoc.css index 52c4ad2..0863257 100644 --- a/doc/ldoc.css +++ b/doc/ldoc.css @@ -1,303 +1,328 @@ -/* BEGIN RESET +@import url(https://fonts.googleapis.com/css?family=Quicksand:300,700); +@import url(https://fonts.googleapis.com/css?family=Lato); -Copyright (c) 2010, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.com/yui/license.html -version: 2.8.2r1 -*/ -html { - color: #000; - background: #FFF; +body { + margin-left: 1em; + margin-right: 1em; + font-family: "Lato", arial, helvetica, geneva, sans-serif; + background-color: #ffffff; + margin: 0px; + color: #1c4e68; } -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { - margin: 0; - padding: 0; + +code, +tt { + font-family: monospace; + font-size: 1.1em; } -table { - border-collapse: collapse; - border-spacing: 0; +span.parameter { + font-family: monospace; } -fieldset,img { - border: 0; +span.parameter:after { + content: ":"; } -address,caption,cite,code,dfn,em,strong,th,var,optgroup { - font-style: inherit; - font-weight: inherit; +span.types:before { + content: "("; } -del,ins { - text-decoration: none; +span.types:after { + content: ")"; } -li { - margin-left: 20px; +.type { + font-weight: bold; + font-style: italic; } -caption,th { - text-align: left; + +body, +p, +td, +th { + font-size: 1em; + line-height: 1.2em; } -h1,h2,h3,h4,h5,h6 { - font-size: 100%; - font-weight: bold; + +p, +ul { + margin: 10px 0 0 0px; } -q:before,q:after { - content: ''; + +strong { + font-weight: bold; } -abbr,acronym { - border: 0; - font-variant: normal; + +em { + font-style: italic; } -sup { - vertical-align: baseline; + +h1 { + font-family: "Quicksand", sans-serif; + font-weight: 700; + color: #ea316e; + font-size: 1.5em; + margin: 20px 0 20px 0; } -sub { - vertical-align: baseline; +h2, +h3, +h4 { + font-family: "Quicksand", sans-serif; + font-weight: 700; + margin: 15px 0 10px 0; } -legend { - color: #000; +h2 { + font-size: 1.25em; + color: #ea316e; } -input,button,textarea,select,optgroup,option { - font-family: inherit; - font-size: inherit; - font-style: inherit; - font-weight: inherit; +h3 { + font-size: 1.15em; } -input,button,textarea,select {*font-size:100%; +h4 { + font-size: 1.06em; } -/* END RESET */ -body { - margin-left: 1em; - margin-right: 1em; - font-family: arial, helvetica, geneva, sans-serif; - background-color: #ffffff; margin: 0px; +a:link { + font-weight: bold; + color: #1c4e68; + text-decoration: none; } - -code, tt { font-family: monospace; font-size: 1.1em; } -span.parameter { font-family:monospace; } -span.parameter:after { content:":"; } -span.types:before { content:"("; } -span.types:after { content:")"; } -.type { font-weight: bold; font-style:italic } - -body, p, td, th { font-size: .95em; line-height: 1.2em;} - -p, ul { margin: 10px 0 0 0px;} - -strong { font-weight: bold;} - -em { font-style: italic;} - -h1 { - font-size: 1.5em; - margin: 20px 0 20px 0; +a:visited { + font-weight: bold; + color: #1e86be; + text-decoration: none; +} +a:link:hover { + text-decoration: underline; } -h2, h3, h4 { margin: 15px 0 10px 0; } -h2 { font-size: 1.25em; } -h3 { font-size: 1.15em; } -h4 { font-size: 1.06em; } - -a:link { font-weight: bold; color: #004080; text-decoration: none; } -a:visited { font-weight: bold; color: #006699; text-decoration: none; } -a:link:hover { text-decoration: underline; } hr { - color:#cccccc; - background: #00007f; - height: 1px; + color: #b1e3fa; + background: #00007f; + height: 1px; } -blockquote { margin-left: 3em; } +blockquote { + margin-left: 3em; +} -ul { list-style-type: disc; } +ul { + list-style-type: disc; +} p.name { - font-family: "Andale Mono", monospace; - padding-top: 1em; + font-family: "Andale Mono", monospace; + padding-top: 1em; } pre { - background-color: rgb(245, 245, 245); - border: 1px solid #C0C0C0; /* silver */ - padding: 10px; - margin: 10px 0 10px 0; - overflow: auto; - font-family: "Andale Mono", monospace; + background-color: rgb(245, 245, 245); + border: 1px solid #c0c0c0; /* silver */ + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; } pre.example { - font-size: .85em; + font-size: 0.85em; } -table.index { border: 1px #00007f; } -table.index td { text-align: left; vertical-align: top; } +table.index { + border: 1px #b1e3fa; +} +table.index td { + text-align: left; + vertical-align: top; +} #container { - margin-left: 1em; - margin-right: 1em; - background-color: #f0f0f0; + margin-left: 1em; + margin-right: 1em; + background-color: #e0f4fc; } #product { - text-align: center; - border-bottom: 1px solid #cccccc; - background-color: #ffffff; + text-align: center; + border-bottom: 1px solid #b1e3fa; + background-color: #ffffff; } #product big { - font-size: 2em; + font-size: 2em; } #main { - background-color: #f0f0f0; - border-left: 2px solid #cccccc; + background-color: #e0f4fc; + border-left: 2px solid #b1e3fa; } #navigation { - float: left; - width: 14em; - vertical-align: top; - background-color: #f0f0f0; - overflow: visible; + float: left; + width: 14em; + vertical-align: top; + background-color: #e0f4fc; + overflow: visible; } #navigation h2 { - background-color:#e7e7e7; - font-size:1.1em; - color:#000000; - text-align: left; - padding:0.2em; - border-top:1px solid #dddddd; - border-bottom:1px solid #dddddd; + background-color: #aee7ff; + font-size: 1.1em; + color: #25aae1; + text-align: left; + padding: 0.2em; + border-top: 1px solid #b1e3fa; + border-bottom: 1px solid #b1e3fa; } -#navigation ul -{ - font-size:1em; - list-style-type: none; - margin: 1px 1px 10px 1px; +#navigation h1 { + font-family: "Quicksand", sans-serif; + font-weight: 300; + font-size: 32px; + padding-left: 20px; + padding-bottom: 20px; +} +#navigation ul { + font-size: 1em; + list-style-type: none; + margin: 1px 1px 10px 1px; + padding-left: 0px; } #navigation li { - text-indent: -1em; - display: block; - margin: 3px 0px 0px 22px; + font-size: 12px; + display: block; + margin: 3px 0px 0px 22px; + padding-left: 0px; } #navigation li li a { - margin: 0px 3px 0px -1em; + margin: 0px 3px 0px -1em; } #content { - margin-left: 14em; - padding: 1em; - width: 700px; - border-left: 2px solid #cccccc; - border-right: 2px solid #cccccc; - background-color: #ffffff; + margin-left: 14em; + padding: 1em; + border-left: 2px solid #b1e3fa; + border-right: 2px solid #b1e3fa; + background-color: #ffffff; } #about { - clear: both; - padding: 5px; - border-top: 2px solid #cccccc; - background-color: #ffffff; + clear: both; + padding: 5px; + border-top: 2px solid #b1e3fa; + background-color: #ffffff; + font-size: 10px; } @media print { - body { - font: 12pt "Times New Roman", "TimeNR", Times, serif; - } - a { font-weight: bold; color: #004080; text-decoration: underline; } - - #main { - background-color: #ffffff; - border-left: 0px; - } - - #container { - margin-left: 2%; - margin-right: 2%; - background-color: #ffffff; - } - - #content { - padding: 1em; - background-color: #ffffff; - } - - #navigation { - display: none; - } - pre.example { - font-family: "Andale Mono", monospace; - font-size: 10pt; - page-break-inside: avoid; - } + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { + font-weight: bold; + color: #1c4e68; + text-decoration: underline; + } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } } table.module_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; + border-width: 1px; + border-style: solid; + border-color: #b1e3fa; + border-collapse: collapse; } table.module_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #b1e3fa; +} +table.module_list td.name { + background-color: #e0f4fc; + min-width: 200px; +} +table.module_list td.summary { + width: 100%; } -table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } -table.module_list td.summary { width: 100%; } - table.function_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; + border-width: 1px; + border-style: solid; + border-color: #b1e3fa; + border-collapse: collapse; } table.function_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #b1e3fa; +} +table.function_list td.name { + background-color: #e0f4fc; + min-width: 200px; +} +table.function_list td.summary { + width: 100%; } -table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } -table.function_list td.summary { width: 100%; } ul.nowrap { - overflow:auto; - white-space:nowrap; + overflow: auto; + white-space: nowrap; } -dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} -dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} -dl.table h3, dl.function h3 {font-size: .95em;} +dl.table dt, +dl.function dt { + border-top: 1px solid #b1e3fa; + padding-top: 1em; +} +dl.table dd, +dl.function dd { + padding-bottom: 1em; + margin: 10px 0 0 20px; +} +dl.table h3, +dl.function h3 { + font-size: 0.95em; +} /* stop sublists from having initial vertical space */ -ul ul { margin-top: 0px; } -ol ul { margin-top: 0px; } -ol ol { margin-top: 0px; } -ul ol { margin-top: 0px; } +ul ul { + margin-top: 0px; +} +ol ul { + margin-top: 0px; +} +ol ol { + margin-top: 0px; +} +ul ol { + margin-top: 0px; +} /* make the target distinct; helps when we're navigating to a function */ a:target + * { - background-color: #FF9; -} - - -/* styles for prettification of source */ -pre .comment { color: #558817; } -pre .constant { color: #a8660d; } -pre .escape { color: #844631; } -pre .keyword { color: #aa5050; font-weight: bold; } -pre .library { color: #0e7c6b; } -pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } -pre .string { color: #8080ff; } -pre .number { color: #f8660d; } -pre .operator { color: #2239a8; font-weight: bold; } -pre .preprocessor, pre .prepro { color: #a33243; } -pre .global { color: #800080; } -pre .user-keyword { color: #800080; } -pre .prompt { color: #558817; } -pre .url { color: #272fc2; text-decoration: underline; } - + background-color: #ff9; +} diff --git a/doc/ldoc_vim.ltp b/doc/ldoc_vim.ltp new file mode 100644 index 0000000..baf388e --- /dev/null +++ b/doc/ldoc_vim.ltp @@ -0,0 +1,230 @@ +# -- Yes this file is a huge mess but working with what we got +# local header = '==============================================================================' +# -- Most stuff copied from ldoc html tempelate +# local no_spaces = ldoc.no_spaces +# local use_li = ldoc.use_li +# local display_name = ldoc.display_name +# local iter = ldoc.modules.iter +# local function M(txt,item) return ldoc.markup(txt,item,ldoc.plain) end +# local nowrap = "" +# local width = #header +# local indentstr = "" +# for i = 1, 4 do indentstr = indentstr .. " " end +# local function new_header(start, e, noh, sep) +# local s = " " +# s = s:rep(width-(#e+ #start)) +# local w = #s + #start + #e +# if w > width then +# local s = " " +# return (noh and "" or header) .. "\n\n".. s:rep(width - #e) .. sep .. e .. sep .. "\n" .. start +# else +# return (noh and "" or header) .. "\n" .. start .. s .. sep .. e .. sep +# end +# end +# +#local function magiclines( str ) +# local pos = 1; +# return function() +# if not pos then return nil end +# local p1, p2 = str:find( "\r?\n", pos ) +# local line +# if p1 then +# line = str:sub( pos, p1 - 1 ) +# pos = p2 + 1 +# else +# line = str:sub( pos ) +# pos = nil +# end +# return line +# end +#end +# local function indent(s, n) +# n = n or 1 +# local a = "" +# local ss = indentstr:rep(n) +# s = s:gsub("^", ss):gsub("\r?\n", "\n" .. ss) +# -- to handle vim style comments +# s = s:gsub(ss .. "<" , "<") +# s = s:gsub(ss .. ">" , ">") +# return s +# end +# if module then -- module documentation +# local intro = module.name:gsub(".*%.", ""):upper() +# if module.name == ldoc.project then +*$(module.name)*$(indentstr)$(module.summary) + +$(module.description) + +# else +$(new_header(intro, module.name .. "-introduction", false, "*")) + +$(module.summary) +$(module.description) +# end +# if module.info then +# for tag, value in module.info:iter() do +$(tag): $(value) +# end +# end -- if module.info + +# if module.usage then +$(new_header("USAGE", module.name .. "-usage", false, "*")) + +# for usage in iter(module.usage) do +$(usage) +# end -- for +# end -- if usage +# if module.tags.include then + $(M(ldoc.include_file(module.tags.include))) +# end +# if module.see then +$(indent("See:"))~ +# for see in iter(module.see) do +$(indent("|" .. see.label, 2))| +# end -- for + +# end -- if see +# if not ldoc.no_summary then +# local function_present = true +# -- bang out the tables of item types for this module (e.g Functions, Tables, etc) +# for kind,items in module.kinds() do +# if function_present then +$(new_header("LUA API", module.name .. "-lua-api", false, "*")) + +# end +# function_present = false +$(kind): ~ +# for item in items() do +$(indentstr)|$(item.name)| - $(M(item.summary,item)) + +# end -- for items +#end -- for kinds +#end -- if not no_summary +# --- currently works for both Functions and Tables. The params field either contains +# --- function parameters or table fields. +# local show_return = not ldoc.no_return_or_parms +# local show_parms = show_return +# for kind, items in module.kinds() do +# for item in items() do +# local plist = "" +# for parm in iter(item.params) do +# local param,sublist = item:subparam(parm) +# for p in iter(param) do +# local name,tp,def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p) +# if plist == "" then +# plist = "{" .. name .. "}" +# else +# plist = plist .. ", " .. "{" .. name .. "}" +# end +# end -- for +# end +# if item.type == "function" then +$(new_header(item.name .. "(" .. plist .. ")", module.name .. "." .. item.name, true, "*")) +# else +$(new_header(item.name,module.name .. "." .. item.name , true, "*")) +#end +$(indent(item.summary)) +# if item.description ~= "" then +$(indent(item.description)) + +# end +# if ldoc.custom_tags then +# for custom in iter(ldoc.custom_tags) do +# local tag = item.tags[custom[1]] +# if tag and not custom.hidden then +# local li,il = use_li(tag) +$(indentstr)$(indentstr)$(custom.title or custom[1]): +# for value in iter(tag) do +$(indentstr)$(indentstr)$(indentstr)$(custom.format and custom.format(value) or M(value)) +# end -- for +# end -- if tag +# end -- iter tags +# end +# if show_parms and item.params and #item.params > 0 then +# local subnames = module.kinds:type_of(item).subnames +# if subnames then + +$(indentstr)$(subnames): ~ +# end +# for parm in iter(item.params) do +# local param,sublist = item:subparam(parm) +# if sublist then + $(sublist) - $(M(item.params.map[sublist],item)) +# end +# for p in iter(param) do +# local name,tp,def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p) +# if tp ~= '' then + $(tp) +# end +$(indent("", 2)){$(name)} - $(M(item.params.map[p],item)) +# if def == true then + (optional) +# elseif def then + (default $(def)) +# end +# if item:readonly(p) then + readonly +# end +# end +# if sublist then +# end +# end -- for +# end -- if params +# if show_return and item.retgroups then local groups = item.retgroups + +$(indentstr)returns:~ +# for i,group in ldoc.ipairs(groups) do local li,il = use_li(group) +# for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type) +# if rt ~= '' then + $(rt) +# end +$(indent("", 2))$(r.text) +# if ctypes then +# for c in ctypes:iter() do + $(c.name) + $(ldoc.typename(c.type)) + $(M(c.comment,item)) +# end +# end -- if ctypes +# end -- for r +# if i < #groups then +Or +# end +# end -- for group +# end -- if returns +# if show_return and item.raise then + Raises: + $(M(item.raise,item)) +# end +# if item.see then +# local see_present = false +# for see in iter(item.see) do +# if not see_present then + +$(indentstr)See also:~ +# end +# see_present = true +$(indentstr)$(indentstr)|$(see.label)| +# end -- for +# end -- if see + +# if item.usage then +$(indentstr)Usage:~ +# for usage in iter(item.usage) do +$(indentstr)$(indentstr)$(usage) +# end -- for +# end -- if usage + +# end -- for items +# end -- for kinds + +# else -- if module; project-level contents +# for kind, mods in ldoc.kinds() do +$(kind) +# kind = kind:lower() +# for m in mods() do +$(nowrap) - "$(no_spaces(kind))/$(m.name).html" - $(m.name) + $(M(ldoc.strip_header(m.summary),m)) +# end -- for modules +# end -- for kinds +# end -- if module diff --git a/doc/modules/colorizer.buffer_utils.html b/doc/modules/colorizer.buffer_utils.html new file mode 100644 index 0000000..f2f75fe --- /dev/null +++ b/doc/modules/colorizer.buffer_utils.html @@ -0,0 +1,222 @@ + + + + + colorizer Docs + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module colorizer.buffer_utils

+

Helper functions to highlight buffer smartly

+

+ +

+ + +

Functions

+ + + + + + + + + +
highlight_buffer (buf, ns, lines, line_start, options)Highlight the buffer region.
rehighlight_buffer (buf, options)Rehighlight the buffer if colorizer is active
+

Tables

+ + + + + +
HIGHLIGHT_MODE_NAMESHighlight mode which will be use to render the colour
+

Fields

+ + + + + +
DEFAULT_NAMESPACEDefault namespace used in highlight_buffer and colorizer.attach_to_buffer.
+ +
+
+ + +

Functions

+ +
+
+ + highlight_buffer (buf, ns, 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 + 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 +
  • +
  • options + table: Configuration options as described in setup +
  • +
+ + + + + +
+
+ + rehighlight_buffer (buf, options) +
+
+ Rehighlight the buffer if colorizer is active + + +

Parameters:

+
    +
  • buf + number: Buffer number +
  • +
  • options + table: Buffer options +
  • +
+ + + + + +
+
+

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_buffer and colorizer.attach_to_buffer. + + + + + +

See also:

+ + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2022-09-03 17:24:13 +
+
+ + diff --git a/doc/modules/colorizer.color_utils.html b/doc/modules/colorizer.color_utils.html new file mode 100644 index 0000000..613185c --- /dev/null +++ b/doc/modules/colorizer.color_utils.html @@ -0,0 +1,355 @@ + + + + + colorizer Docs + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module colorizer.color_utils

+

Helper functions to parse different colour formats

+

+ +

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
color_is_bright (r, g, b)Determine whether to use black or white text.
color_name_parser (line, i)Grab all the colour values from vim.api.nvim_get_color_map and create a lookup table.
rgb_function_parser (line, i)Parse for rgb() css function and return rgb hex.
rgba_function_parser (line, i)Parse for rgba() css function and return rgb hex.
hsl_function_parser (line, i)Parse for hsl() css function and return rgb hex.
hsla_function_parser (line, i)Parse for hsl() css function and return rgb hex.
argb_hex_parser (line, i)parse for 0xaarrggbb and return rgb hex.
rgba_hex_parser (line, i, opts)parse for #rrggbbaa and return rgb hex.
+ +
+
+ + +

Functions

+ +
+
+ + color_is_bright (r, g, b) +
+
+ Determine whether to use black or white text.

+ +

ref: https://stackoverflow.com/a/1855903/837964 + https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color + + +

Parameters:

+
    +
  • r + number: Red +
  • +
  • g + number: Green +
  • +
  • b + number: Blue +
  • +
+ + + + + +
+
+ + color_name_parser (line, i) +
+
+ Grab all the colour values from vim.api.nvim_get_color_map and create a lookup table. + COLOR_MAP is used to store the colour values + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ + + + + +
+
+ + rgb_function_parser (line, i) +
+
+ Parse for rgb() css function and return rgb hex. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the rgb function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + rgba_function_parser (line, i) +
+
+ Parse for rgba() css function and return rgb hex. + Todo consider removing the regexes here + Todo this might not be the best approach to alpha channel. + Things like pumblend might be useful here. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the rgba function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + hsl_function_parser (line, i) +
+
+ Parse for hsl() css function and return rgb hex. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the hsl function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + hsla_function_parser (line, i) +
+
+ Parse for hsl() css function and return rgb hex. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the hsla function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + argb_hex_parser (line, i) +
+
+ parse for 0xaarrggbb and return rgb hex. + a format used in android apps + + +

Parameters:

+
    +
  • line + string: line to parse +
  • +
  • i + number: index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: index of line where the hex value ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + rgba_hex_parser (line, i, opts) +
+
+ parse for #rrggbbaa and return rgb hex. + a format used in android apps + + +

Parameters:

+
    +
  • line + string: line to parse +
  • +
  • i + number: index of line from where to start parsing +
  • +
  • opts + table: Containing minlen, maxlen, valid_lengths +
  • +
+ +

Returns:

+
    +
  1. + number|nil: index of line where the hex value ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2022-09-03 17:24:13 +
+
+ + 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:

+
    +
     Establish the autocmd to highlight all filetypes.
    +
    +       `lua require 'colorizer'.setup()`
    +
    + Highlight using all css highlight modes in every filetype
    +
    +       `lua require 'colorizer'.setup(user_default_options = { css = true; })`
    +
    +==============================================================================
    +USE WITH COMMANDS                                          *colorizer-commands*
    +
    +   *:ColorizerAttachToBuffer*
    +
    +       Attach to the current buffer and start highlighting with the settings as
    +       specified in setup (or the defaults).
    +
    +       If the buffer was already attached(i.e. being highlighted), the
    +       settings will be reloaded with the ones from setup.
    +       This is useful for reloading settings for just one buffer.
    +
    +   *:ColorizerDetachFromBuffer*
    +
    +       Stop highlighting the current buffer (detach).
    +
    +   *:ColorizerReloadAllBuffers*
    +
    +       Reload all buffers that are being highlighted currently.
    +       Shortcut for ColorizerAttachToBuffer on every buffer.
    +
    +   *:ColorizerToggle*
    +       Toggle highlighting of the current buffer.
    +
    +USE WITH LUA
    +
    +       All options that can be passed to user_default_options in `setup`
    +       can be passed here. Can be empty too.
    +       `0` is the buffer number here
    +
    +       Attach to current buffer <pre>
    +           require("colorizer").attach_to_buffer(0, {
    +             mode = "background",
    +             css = false,
    +           })
    +</pre>
    +       Detach from buffer <pre>
    +           require("colorizer").detach_from_buffer(0, {
    +             mode = "background",
    +             css = false,
    +           })
    +</pre>
    +
    +
+

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
diff --git a/doc/modules/colorizer.matcher_utils.html b/doc/modules/colorizer.matcher_utils.html new file mode 100644 index 0000000..e709932 --- /dev/null +++ b/doc/modules/colorizer.matcher_utils.html @@ -0,0 +1,113 @@ + + + + + colorizer Docs + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module colorizer.matcher_utils

+

Helper functions for colorizer to enable required parsers

+

+ +

+ + +

Functions

+ + + + + +
make_matcher (options)Parse the given options and return a function with enabled parsers.
+ +
+
+ + +

Functions

+ +
+
+ + make_matcher (options) +
+
+ Parse the given options and return a function with enabled parsers. +if no parsers enabled then return false +Do not try make the function again if it is present in the cache + + +

Parameters:

+ + +

Returns:

+
    + + function|boolean: function which will just parse the line for enabled parsers +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2022-09-03 17:24:13 +
+
+ + diff --git a/doc/modules/colorizer.trie.html b/doc/modules/colorizer.trie.html new file mode 100644 index 0000000..0261786 --- /dev/null +++ b/doc/modules/colorizer.trie.html @@ -0,0 +1,69 @@ + + + + + colorizer Docs + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module colorizer.trie

+

Trie implementation in luajit.

+

todo: write documentation

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.6 +Last updated 2022-09-03 17:24:13 +
+
+ + diff --git a/doc/modules/colorizer.utils.html b/doc/modules/colorizer.utils.html new file mode 100644 index 0000000..9bca259 --- /dev/null +++ b/doc/modules/colorizer.utils.html @@ -0,0 +1,87 @@ +============================================================================== +UTILS *colorizer.utils* + +Helper utils + + +============================================================================== +LUA API *colorizer.utils* + +Available Functions: + + |colorizer.utils.byte_is_alphanumeric| - Obvious + + |colorizer.utils.byte_is_hex| - Obvious + + |colorizer.utils.merge| - Merge two tables + TODO Remove this and use vim.tbl_deep_extend + + |colorizer.utils.parse_hex| - Obvious + + |colorizer.utils.percent_or_hex| - Obvious + + + +byte_is_alphanumeric({byte}) |colorizer.utils.byte_is_alphanumeric| + Obvious + + + Parameters: + {byte} - number + + Returns: + boolean + + + +byte_is_hex({byte}) |colorizer.utils.byte_is_hex| + Obvious + + + Parameters: + {byte} - number + + Returns: + boolean + + + +merge({...}) |colorizer.utils.merge| + Merge two tables + TODO Remove this and use vim.tbl_deep_extend + + + Parameters: + {...} - + + Returns: + table + + + +parse_hex({byte}) |colorizer.utils.parse_hex| + Obvious + + + Parameters: + {byte} - number + + Returns: + number + + + +percent_or_hex({v}) |colorizer.utils.percent_or_hex| + Obvious + + + Parameters: + {v} - string + + Returns: + number|nil + + + + + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/doc/modules/nvim.html b/doc/modules/nvim.html deleted file mode 100644 index 8009822..0000000 --- a/doc/modules/nvim.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module nvim

-

Module of magic functions for nvim

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.6 -Last updated 2019-10-18 09:40:19 -
-
- - diff --git a/doc/modules/trie.html b/doc/modules/trie.html index 5496cfd..e353630 100644 --- a/doc/modules/trie.html +++ b/doc/modules/trie.html @@ -3,7 +3,7 @@ - Reference + colorizer Docs @@ -24,7 +24,7 @@ @@ -44,9 +47,19 @@

Module trie

-

Trie implementation in luajit - Copyright © 2019 Ashkan Kiani

-

+

Trie implementation in luajit.

+

Copyright © 2019 Ashkan Kiani + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version.

+ +

This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/.

@@ -60,7 +73,7 @@
generated by LDoc 1.4.6 -Last updated 2019-10-18 09:40:19 +Last updated 2022-09-02 21:37:16
diff --git a/doc/modules/utils.html b/doc/modules/utils.html new file mode 100644 index 0000000..3e3ff4d --- /dev/null +++ b/doc/modules/utils.html @@ -0,0 +1,231 @@ + + + + + colorizer Docs + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils

+

Helper utils

+

+ +

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + +
byte_is_alphanumeric (byte)Obvious.
byte_is_hex (byte)Obvious.
merge (...)Merge two tables.
parse_hex (byte)Obvious.
percent_or_hex (v)Obvious.
+ +
+
+ + +

Functions

+ +
+
+ + byte_is_alphanumeric (byte) +
+
+ Obvious. + + +

Parameters:

+
    +
  • byte + number +
  • +
+ +

Returns:

+
    + + boolean +
+ + + + +
+
+ + byte_is_hex (byte) +
+
+ Obvious. + + +

Parameters:

+
    +
  • byte + number +
  • +
+ +

Returns:

+
    + + boolean +
+ + + + +
+
+ + merge (...) +
+
+ Merge two tables.

+ +

todo: Remove this and use vim.tbl_deep_extend + + +

Parameters:

+
    +
  • ... + + + +
  • +
+ +

Returns:

+
    + + table +
+ + + + +
+
+ + parse_hex (byte) +
+
+ Obvious. + + +

Parameters:

+
    +
  • byte + number +
  • +
+ +

Returns:

+
    + + number +
+ + + + +
+
+ + percent_or_hex (v) +
+
+ Obvious. + + +

Parameters:

+
    +
  • v + string +
  • +
+ +

Returns:

+
    + + number|nil +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2022-09-03 17:24:13 +
+
+ + diff --git a/doc/tags b/doc/tags new file mode 100644 index 0000000..bb5229d --- /dev/null +++ b/doc/tags @@ -0,0 +1,37 @@ +:ColorizerAttachToBuffer colorizer.txt /*:ColorizerAttachToBuffer* +:ColorizerDetachFromBuffer colorizer.txt /*:ColorizerDetachFromBuffer* +:ColorizerReloadAllBuffers colorizer.txt /*:ColorizerReloadAllBuffers* +:ColorizerToggle colorizer.txt /*:ColorizerToggle* +colorizer colorizer.txt /*colorizer* +colorizer-commands colorizer.txt /*colorizer-commands* +colorizer-lua-api colorizer.txt /*colorizer-lua-api* +colorizer-usage colorizer.txt /*colorizer-usage* +colorizer.DEFAULT_NAMESPACE colorizer.txt /*colorizer.DEFAULT_NAMESPACE* +colorizer.attach_to_buffer colorizer.txt /*colorizer.attach_to_buffer* +colorizer.buffer_utils-introduction colorizer.txt /*colorizer.buffer_utils-introduction* +colorizer.buffer_utils-lua-api colorizer.txt /*colorizer.buffer_utils-lua-api* +colorizer.buffer_utils.DEFAULT_NAMESPACE colorizer.txt /*colorizer.buffer_utils.DEFAULT_NAMESPACE* +colorizer.buffer_utils.HIGHLIGHT_MODE_NAMES colorizer.txt /*colorizer.buffer_utils.HIGHLIGHT_MODE_NAMES* +colorizer.buffer_utils.highlight_buffer colorizer.txt /*colorizer.buffer_utils.highlight_buffer* +colorizer.buffer_utils.rehighlight_buffer colorizer.txt /*colorizer.buffer_utils.rehighlight_buffer* +colorizer.clear_highlight_cache colorizer.txt /*colorizer.clear_highlight_cache* +colorizer.color_utils-introduction colorizer.txt /*colorizer.color_utils-introduction* +colorizer.color_utils-lua-api colorizer.txt /*colorizer.color_utils-lua-api* +colorizer.color_utils.argb_hex_parser colorizer.txt /*colorizer.color_utils.argb_hex_parser* +colorizer.color_utils.color_is_bright colorizer.txt /*colorizer.color_utils.color_is_bright* +colorizer.color_utils.color_name_parser colorizer.txt /*colorizer.color_utils.color_name_parser* +colorizer.color_utils.hsl_function_parser colorizer.txt /*colorizer.color_utils.hsl_function_parser* +colorizer.color_utils.hsla_function_parser colorizer.txt /*colorizer.color_utils.hsla_function_parser* +colorizer.color_utils.rgb_function_parser colorizer.txt /*colorizer.color_utils.rgb_function_parser* +colorizer.color_utils.rgba_function_parser colorizer.txt /*colorizer.color_utils.rgba_function_parser* +colorizer.color_utils.rgba_hex_parser colorizer.txt /*colorizer.color_utils.rgba_hex_parser* +colorizer.detach_from_buffer colorizer.txt /*colorizer.detach_from_buffer* +colorizer.get_buffer_options colorizer.txt /*colorizer.get_buffer_options* +colorizer.highlight_buffer colorizer.txt /*colorizer.highlight_buffer* +colorizer.is_buffer_attached colorizer.txt /*colorizer.is_buffer_attached* +colorizer.matcher_utils-introduction colorizer.txt /*colorizer.matcher_utils-introduction* +colorizer.matcher_utils-lua-api colorizer.txt /*colorizer.matcher_utils-lua-api* +colorizer.matcher_utils.make_matcher colorizer.txt /*colorizer.matcher_utils.make_matcher* +colorizer.reload_all_buffers colorizer.txt /*colorizer.reload_all_buffers* +colorizer.setup colorizer.txt /*colorizer.setup* +colorizer.trie-introduction colorizer.txt /*colorizer.trie-introduction* -- cgit v1.2.3-70-g09d2