From 615e32c94fdb4c83f06b65902f10434a1bd0d495 Mon Sep 17 00:00:00 2001 From: Ashkan Kiani Date: Fri, 18 Oct 2019 09:43:18 -0700 Subject: Update docs and luadocs --- doc/index.html | 7 +++- doc/modules/colorizer.html | 89 ++++++++++++++++++++++++++++++++++++++++++---- doc/modules/nvim.html | 66 ++++++++++++++++++++++++++++++++++ doc/modules/trie.html | 3 +- lua/colorizer.lua | 34 +++++++++++------- 5 files changed, 178 insertions(+), 21 deletions(-) create mode 100644 doc/modules/nvim.html 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 @@

Modules

@@ -47,6 +48,10 @@ colorizer Highlights terminal CSI ANSI color codes. + + nvim + Module of magic functions for nvim + trie Trie implementation in luajit @@ -58,7 +63,7 @@
generated by LDoc 1.4.6 -Last updated 2019-10-17 16:25:49 +Last updated 2019-10-18 09:40:19
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 @@

Modules

@@ -55,17 +56,29 @@

Functions

- + - + + + + + + + + + + + + +
highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start[, options])highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options) Highlight the buffer region.
attach_to_buffer ([buf=0[, options]])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

@@ -84,7 +97,7 @@
- highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start[, options]) + highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options)
Highlight the buffer region. @@ -114,7 +127,6 @@ buffer `buf` and attach it to the namespace `ns`.
  • options Configuration options as described in `setup` - (optional)
  • @@ -129,7 +141,7 @@ buffer `buf` and attach it to the namespace `ns`.
    - attach_to_buffer ([buf=0[, options]]) + attach_to_buffer ([buf=0|nil[, options]])
    Attach to a buffer and continuously highlight changes. @@ -140,7 +152,7 @@ buffer `buf` and attach it to the namespace `ns`.
  • buf integer A value of 0 implies the current buffer. - (default 0) + (default 0|nil)
  • options Configuration options as described in `setup` @@ -156,6 +168,33 @@ buffer `buf` and attach it to the namespace `ns`. +
  • +
    + + 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) +
    • +
    + + + + +
    @@ -198,6 +237,42 @@ buffer `buf` and attach it to the namespace `ns`.
    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

    @@ -230,7 +305,7 @@ buffer `buf` and attach it to the namespace `ns`.
    generated by LDoc 1.4.6 -Last updated 2019-10-17 16:25:49 +Last updated 2019-10-18 09:40:19
    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 @@ + + + + + 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 898b18e..5496cfd 100644 --- a/doc/modules/trie.html +++ b/doc/modules/trie.html @@ -35,6 +35,7 @@

    Modules

    @@ -59,7 +60,7 @@
    generated by LDoc 1.4.6 -Last updated 2019-10-17 16:25:49 +Last updated 2019-10-18 09:40:19
    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; } -- cgit v1.2.3-70-g09d2