Home Explore Blog CI



neovim

59th chunk of `runtime/doc/lua.txt`
a9c79bd5d871d9b783b11fc4c637e48003ce8e8a044be2430000000100000882

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})                               *vim.text.hexdecode()*
    Hex decode a string.

    Parameters: ~
      • {enc}  (`string`) String to decode

    Return (multiple): ~
        (`string?`) Decoded string
        (`string?`) Error message, if any

vim.text.hexencode({str})                               *vim.text.hexencode()*
    Hex encode a string.

    Parameters: ~
      • {str}  (`string`) String to encode

    Return: ~
        (`string`) Hex encoded string

vim.text.indent({size}, {text}, {opts})                    *vim.text.indent()*
    Sets the indent (i.e. the common leading whitespace) of non-empty lines in
    `text` to `size` spaces/tabs.

    Indent is calculated by number of consecutive indent chars.
    • The first indented, non-empty line decides the indent char (space/tab):
      • `SPC SPC TAB …` = two-space indent.
      • `TAB SPC …` = one-tab indent.
    • Set `opts.expandtab` to treat tabs as spaces.

    To "dedent" (remove the common indent), pass `size=0`: >lua
        vim.print(vim.text.indent(0, ' a\n  b\n'))
<

    To adjust relative-to an existing indent, call indent() twice: >lua
        local indented, old_indent

Title: vim.snippet.jump, vim.snippet.stop, vim.text.hexdecode, vim.text.hexencode, vim.text.indent
Summary
This section describes `vim.snippet.jump()`, which moves to the next or previous placeholder in a snippet. It also covers `vim.snippet.stop()`, which exits the current snippet. Furthermore, it details `vim.text.hexdecode()`, which hex decodes a string, `vim.text.hexencode()`, which hex encodes a string, and `vim.text.indent()`, which sets the indent of non-empty lines in a text.