Home Explore Blog CI



neovim

26th chunk of `runtime/doc/lua.txt`
9f59e774009a99cc9966e7c6e83c71b7e5c023980b17439b0000000100000fc7
 the row used to get the items
        • col: the col used to get the items

vim.show_pos({bufnr}, {row}, {col}, {filter})                 *vim.show_pos()*
    Show all the items at a given buffer position.

    Can also be shown with `:Inspect`.                              *:Inspect*

    Example: To bind this function to the vim-scriptease inspired `zS` in
    Normal mode: >lua
        vim.keymap.set('n', 'zS', vim.show_pos)
<

    Attributes: ~
        Since: 0.9.0

    Parameters: ~
      • {bufnr}   (`integer?`) defaults to the current buffer
      • {row}     (`integer?`) row to inspect, 0-based. Defaults to the row of
                  the current cursor
      • {col}     (`integer?`) col to inspect, 0-based. Defaults to the col of
                  the current cursor
      • {filter}  (`table?`) A table with the following fields:
                  • {syntax} (`boolean`, default: `true`) Include syntax based
                    highlight groups.
                  • {treesitter} (`boolean`, default: `true`) Include
                    treesitter based highlight groups.
                  • {extmarks} (`boolean|"all"`, default: true) Include
                    extmarks. When `all`, then extmarks without a `hl_group`
                    will also be included.
                  • {semantic_tokens} (`boolean`, default: true) Include
                    semantic token highlights.




*vim.Ringbuf*

    Fields: ~
      • {clear}  (`fun()`) See |Ringbuf:clear()|.
      • {push}   (`fun(item: T)`) See |Ringbuf:push()|.
      • {pop}    (`fun(): T?`) See |Ringbuf:pop()|.
      • {peek}   (`fun(): T?`) See |Ringbuf:peek()|.


Ringbuf:clear()                                              *Ringbuf:clear()*
    Clear all items

Ringbuf:peek()                                                *Ringbuf:peek()*
    Returns the first unread item without removing it

    Return: ~
        (`any?`)

Ringbuf:pop()                                                  *Ringbuf:pop()*
    Removes and returns the first unread item

    Return: ~
        (`any?`)

Ringbuf:push({item})                                          *Ringbuf:push()*
    Adds an item, overriding the oldest item if the buffer is full.

    Parameters: ~
      • {item}  (`any`)

vim.deep_equal({a}, {b})                                    *vim.deep_equal()*
    Deep compare values for equality

    Tables are compared recursively unless they both provide the `eq`
    metamethod. All other types are compared using the equality `==` operator.

    Parameters: ~
      • {a}  (`any`) First value
      • {b}  (`any`) Second value

    Return: ~
        (`boolean`) `true` if values are equals, else `false`

vim.deepcopy({orig}, {noref})                                 *vim.deepcopy()*
    Returns a deep copy of the given object. Non-table objects are copied as
    in a typical Lua assignment, whereas table objects are copied recursively.
    Functions are naively copied, so functions in the copied table point to
    the same functions as those in the input table. Userdata and threads are
    not copied and will throw an error.

    Note: `noref=true` is much more performant on tables with unique table
    fields, while `noref=false` is more performant on tables that reuse table
    fields.

    Parameters: ~
      • {orig}   (`table`) Table to copy
      • {noref}  (`boolean?`) When `false` (default) a contained table is only
                 copied once and all references point to this single copy.
                 When `true` every occurrence of a table results in a new
                 copy. This also means that a cyclic reference can cause
                 `deepcopy()` to fail.

    Return: ~
        (`table`) Table of copied keys and (nested) values.

vim.defaulttable({createfn})                              *vim.defaulttable()*
    Creates a table whose missing keys are provided by {createfn} (like
    Python's "defaultdict").

    If {createfn} is `nil` it defaults to defaulttable()

Title: Lua API: vim.show_pos(), vim.Ringbuf, vim.deep_equal(), vim.deepcopy(), vim.defaulttable()
Summary
This section continues documenting the Lua API for Neovim. It starts with a description of `vim.show_pos()`, which displays items at a given buffer position and provides a mapping example. It then details `vim.Ringbuf`, a ring buffer implementation with `clear`, `push`, `pop`, and `peek` methods. After that, it introduces `vim.deep_equal()` for deep comparison of values, `vim.deepcopy()` for recursively copying tables, and `vim.defaulttable()` for creating tables with default values provided by a create function.