Home Explore Blog CI



neovim

58th chunk of `runtime/doc/lua.txt`
7b6e1f34f1d4e33035220074e5b61f769c8f25e70751c6ee0000000100000d29

        it:next()
        -- nil
<

    Parameters: ~
      • {n}  (`integer`)

    Return: ~
        (`Iter`)

Iter:totable()                                                *Iter:totable()*
    Collect the iterator into a table.

    The resulting table depends on the initial source in the iterator
    pipeline. Array-like tables and function iterators will be collected into
    an array-like table. If multiple values are returned from the final stage
    in the iterator pipeline, each value will be included in a table.

    Examples: >lua
        vim.iter(string.gmatch('100 20 50', '%d+')):map(tonumber):totable()
        -- { 100, 20, 50 }

        vim.iter({ 1, 2, 3 }):map(function(v) return v, 2 * v end):totable()
        -- { { 1, 2 }, { 2, 4 }, { 3, 6 } }

        vim.iter({ a = 1, b = 2, c = 3 }):filter(function(k, v) return v % 2 ~= 0 end):totable()
        -- { { 'a', 1 }, { 'c', 3 } }
<

    The generated table is an array-like table with consecutive, numeric
    indices. To create a map-like table with arbitrary keys, use
    |Iter:fold()|.

    Return: ~
        (`table`)


==============================================================================
Lua module: vim.snippet                                          *vim.snippet*

*vim.snippet.ActiveFilter*

    Fields: ~
      • {direction}  (`vim.snippet.Direction`) Navigation direction. -1 for
                     previous, 1 for next.


vim.snippet.active({filter})                            *vim.snippet.active()*
    Returns `true` if there's an active snippet in the current buffer,
    applying the given filter if provided.

    Parameters: ~
      • {filter}  (`vim.snippet.ActiveFilter?`) Filter to constrain the search
                  with:
                  • `direction` (vim.snippet.Direction): Navigation direction.
                    Will return `true` if the snippet can be jumped in the
                    given direction. See |vim.snippet.ActiveFilter|.

    Return: ~
        (`boolean`)

vim.snippet.expand({input})                             *vim.snippet.expand()*
    Expands the given snippet text. Refer to
    https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax
    for the specification of valid input.

    Tabstops are highlighted with |hl-SnippetTabstop|.

    Parameters: ~
      • {input}  (`string`)

vim.snippet.jump({direction})                             *vim.snippet.jump()*
    Jumps to the next (or previous) placeholder in the current snippet, if
    possible.

    By default `<Tab>` is setup to jump if a snippet is active. The default
    mapping looks like: >lua
        vim.keymap.set({ 'i', 's' }, '<Tab>', function()
           if vim.snippet.active({ direction = 1 }) then
             return '<Cmd>lua vim.snippet.jump(1)<CR>'
           else
             return '<Tab>'
           end
         end, { descr = '...', expr = true, silent = true })
<

    Parameters: ~
      • {direction}  (`vim.snippet.Direction`) Navigation direction. -1 for
                     previous, 1 for next.

vim.snippet.stop()                                        *vim.snippet.stop()*
    Exits the current snippet.


==============================================================================
Lua module: vim.text                                                *vim.text*

vim.text.hexdecode({enc})

Title: Iter:totable, vim.snippet, vim.text
Summary
This section describes the `Iter:totable` function, which collects an iterator into a table. It also covers the `vim.snippet` module, including `vim.snippet.ActiveFilter`, `vim.snippet.active()`, `vim.snippet.expand()`, `vim.snippet.jump()`, and `vim.snippet.stop()`. Additionally, it introduces the `vim.text` module and its function `vim.text.hexdecode()`.