diff options
author | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-10-18 09:43:18 -0700 |
---|---|---|
committer | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-10-18 09:43:18 -0700 |
commit | 615e32c94fdb4c83f06b65902f10434a1bd0d495 (patch) | |
tree | 92f0c49305f3b1fab635d37d07e03cc793e62d0c | |
parent | Update with fully qualified settings and commands. (diff) |
Update docs and luadocs
-rw-r--r-- | doc/index.html | 7 | ||||
-rw-r--r-- | doc/modules/colorizer.html | 89 | ||||
-rw-r--r-- | doc/modules/nvim.html | 66 | ||||
-rw-r--r-- | doc/modules/trie.html | 3 | ||||
-rw-r--r-- | lua/colorizer.lua | 34 |
5 files changed, 178 insertions, 21 deletions
diff --git a/doc/index.html b/doc/index.html index 371e5da..fdeae17 100644 --- a/doc/index.html +++ b/doc/index.html @@ -32,6 +32,7 @@ <h2>Modules</h2> <ul class="nowrap"> <li><a href="modules/colorizer.html">colorizer</a></li> + <li><a href="modules/nvim.html">nvim</a></li> <li><a href="modules/trie.html">trie</a></li> </ul> @@ -48,6 +49,10 @@ <td class="summary">Highlights terminal CSI ANSI color codes.</td> </tr> <tr> + <td class="name" nowrap><a href="modules/nvim.html">nvim</a></td> + <td class="summary">Module of magic functions for nvim</td> + </tr> + <tr> <td class="name" nowrap><a href="modules/trie.html">trie</a></td> <td class="summary">Trie implementation in luajit Copyright © 2019 Ashkan Kiani</td> @@ -58,7 +63,7 @@ </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2019-10-17 16:25:49 </i> +<i style="float:right;">Last updated 2019-10-18 09:40:19 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.html b/doc/modules/colorizer.html index adce131..e02d18a 100644 --- a/doc/modules/colorizer.html +++ b/doc/modules/colorizer.html @@ -40,6 +40,7 @@ <h2>Modules</h2> <ul class="nowrap"> <li><strong>colorizer</strong></li> + <li><a href="../modules/nvim.html">nvim</a></li> <li><a href="../modules/trie.html">trie</a></li> </ul> @@ -55,17 +56,29 @@ <h2><a href="#Functions">Functions</a></h2> <table class="function_list"> <tr> - <td class="name" nowrap><a href="#highlight_buffer">highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start[, options])</a></td> + <td class="name" nowrap><a href="#highlight_buffer">highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options)</a></td> <td class="summary">Highlight the buffer region.</td> </tr> <tr> - <td class="name" nowrap><a href="#attach_to_buffer">attach_to_buffer ([buf=0[, options]])</a></td> + <td class="name" nowrap><a href="#attach_to_buffer">attach_to_buffer ([buf=0|nil[, options]])</a></td> <td class="summary">Attach to a buffer and continuously highlight changes.</td> </tr> <tr> + <td class="name" nowrap><a href="#detach_from_buffer">detach_from_buffer ([buf=0|nil[, ns=DEFAULT_NAMESPACE]])</a></td> + <td class="summary">Stop highlighting the current buffer.</td> + </tr> + <tr> <td class="name" nowrap><a href="#setup">setup ([filetypes={'*'}[, default_options]])</a></td> <td class="summary">Easy to use function if you want the full setup without fine grained control.</td> </tr> + <tr> + <td class="name" nowrap><a href="#reload_all_buffers">reload_all_buffers ()</a></td> + <td class="summary">Reload all of the currently active highlighted buffers.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#get_buffer_options">get_buffer_options ([buf=0|nil])</a></td> + <td class="summary">Return the currently active buffer options.</td> + </tr> </table> <h2><a href="#Fields">Fields</a></h2> <table class="function_list"> @@ -84,7 +97,7 @@ <dl class="function"> <dt> <a name = "highlight_buffer"></a> - <strong>highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start[, options])</strong> + <strong>highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options)</strong> </dt> <dd> Highlight the buffer region. @@ -114,7 +127,6 @@ buffer `buf` and attach it to the namespace `ns`. </li> <li><span class="parameter">options</span> Configuration options as described in `setup` - (<em>optional</em>) </li> </ul> @@ -129,7 +141,7 @@ buffer `buf` and attach it to the namespace `ns`. </dd> <dt> <a name = "attach_to_buffer"></a> - <strong>attach_to_buffer ([buf=0[, options]])</strong> + <strong>attach_to_buffer ([buf=0|nil[, options]])</strong> </dt> <dd> Attach to a buffer and continuously highlight changes. @@ -140,7 +152,7 @@ buffer `buf` and attach it to the namespace `ns`. <li><span class="parameter">buf</span> <span class="types"><span class="type">integer</span></span> A value of 0 implies the current buffer. - (<em>default</em> 0) + (<em>default</em> 0|nil) </li> <li><span class="parameter">options</span> Configuration options as described in `setup` @@ -158,6 +170,33 @@ buffer `buf` and attach it to the namespace `ns`. </dd> <dt> + <a name = "detach_from_buffer"></a> + <strong>detach_from_buffer ([buf=0|nil[, ns=DEFAULT_NAMESPACE]])</strong> + </dt> + <dd> + Stop highlighting the current buffer. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">buf</span> + <span class="types"><span class="type">integer</span></span> + A value of 0 or nil implies the current buffer. + (<em>default</em> 0|nil) + </li> + <li><span class="parameter">ns</span> + <span class="types"><span class="type">integer</span></span> + the namespace id. + (<em>default</em> DEFAULT_NAMESPACE) + </li> + </ul> + + + + + +</dd> + <dt> <a name = "setup"></a> <strong>setup ([filetypes={'*'}[, default_options]])</strong> </dt> @@ -199,6 +238,42 @@ buffer `buf` and attach it to the namespace `ns`. </ul> </dd> + <dt> + <a name = "reload_all_buffers"></a> + <strong>reload_all_buffers ()</strong> + </dt> + <dd> + Reload all of the currently active highlighted buffers. + + + + + + + +</dd> + <dt> + <a name = "get_buffer_options"></a> + <strong>get_buffer_options ([buf=0|nil])</strong> + </dt> + <dd> + Return the currently active buffer options. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">buf</span> + <span class="types"><span class="type">integer</span></span> + A value of 0 or nil implies the current buffer. + (<em>default</em> 0|nil) + </li> + </ul> + + + + + +</dd> </dl> <h2 class="section-header "><a name="Fields"></a>Fields</h2> @@ -230,7 +305,7 @@ buffer `buf` and attach it to the namespace `ns`. </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2019-10-17 16:25:49 </i> +<i style="float:right;">Last updated 2019-10-18 09:40:19 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/nvim.html b/doc/modules/nvim.html new file mode 100644 index 0000000..8009822 --- /dev/null +++ b/doc/modules/nvim.html @@ -0,0 +1,66 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Reference</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>ldoc</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/colorizer.html">colorizer</a></li> + <li><strong>nvim</strong></li> + <li><a href="../modules/trie.html">trie</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>nvim</code></h1> +<p>Module of magic functions for nvim</p> +<p></p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +<i style="float:right;">Last updated 2019-10-18 09:40:19 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/trie.html b/doc/modules/trie.html index 898b18e..5496cfd 100644 --- a/doc/modules/trie.html +++ b/doc/modules/trie.html @@ -35,6 +35,7 @@ <h2>Modules</h2> <ul class="nowrap"> <li><a href="../modules/colorizer.html">colorizer</a></li> + <li><a href="../modules/nvim.html">nvim</a></li> <li><strong>trie</strong></li> </ul> @@ -59,7 +60,7 @@ </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2019-10-17 16:25:49 </i> +<i style="float:right;">Last updated 2019-10-18 09:40:19 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/lua/colorizer.lua b/lua/colorizer.lua index 36c093e..b869897 100644 --- a/lua/colorizer.lua +++ b/lua/colorizer.lua @@ -211,7 +211,7 @@ local function new_buffer_options(buf) end --- Attach to a buffer and continuously highlight changes. --- @tparam[opt=0] integer buf A value of 0 implies the current buffer. +-- @tparam[opt=0|nil] integer buf A value of 0 implies the current buffer. -- @param[opt] options Configuration options as described in `setup` -- @see setup local function attach_to_buffer(buf, options) @@ -246,6 +246,9 @@ local function attach_to_buffer(buf, options) }) end +--- Stop highlighting the current buffer. +-- @tparam[opt=0|nil] integer buf A value of 0 or nil implies the current buffer. +-- @tparam[opt=DEFAULT_NAMESPACE] integer ns the namespace id. local function detach_from_buffer(buf, ns) if buf == 0 or buf == nil then buf = nvim_get_current_buf() @@ -320,6 +323,22 @@ local function setup(filetypes, default_options) nvim.ex.augroup("END") end +--- Reload all of the currently active highlighted buffers. +local function reload_all_buffers() + for buf, buffer_options in pairs(BUFFER_OPTIONS) do + attach_to_buffer(buf) + end +end + +--- Return the currently active buffer options. +-- @tparam[opt=0|nil] integer buf A value of 0 or nil implies the current buffer. +local function get_buffer_options(buf) + if buf == 0 or buf == nil then + buf = nvim_get_current_buf() + end + return merge({}, BUFFER_OPTIONS[buf]) +end + --- @export return { DEFAULT_NAMESPACE = DEFAULT_NAMESPACE; @@ -327,17 +346,8 @@ return { attach_to_buffer = attach_to_buffer; detach_from_buffer = detach_from_buffer; highlight_buffer = highlight_buffer; - reload_all_buffers = function() - for buf, buffer_options in pairs(BUFFER_OPTIONS) do - attach_to_buffer(buf) - end - end; - get_buffer_options = function(buf) - if buf == 0 or buf == nil then - buf = nvim_get_current_buf() - end - return merge({}, BUFFER_OPTIONS[buf]) - end; + reload_all_buffers = reload_all_buffers; + get_buffer_options = get_buffer_options; -- initialize = initialize_trie; } |