Home Explore Blog CI



neovim

11th chunk of `runtime/doc/lua.txt`
ddb324c2f1e527dfd98c32d36bdd295bf7b10a726edf61ae0000000100000fce
 algorithm
                • {ctxlen}? (`integer`) Context length
                • {interhunkctxlen}? (`integer`) Inter hunk context length
                • {ignore_whitespace}? (`boolean`) Ignore whitespace
                • {ignore_whitespace_change}? (`boolean`) Ignore whitespace
                  change
                • {ignore_whitespace_change_at_eol}? (`boolean`) Ignore
                  whitespace change at end-of-line.
                • {ignore_cr_at_eol}? (`boolean`) Ignore carriage return at
                  end-of-line
                • {ignore_blank_lines}? (`boolean`) Ignore blank lines
                • {indent_heuristic}? (`boolean`) Use the indent heuristic for
                  the internal diff library.

    Return: ~
        (`string|integer[][]?`) See {opts.result_type}. `nil` if
        {opts.on_hunk} is given.


==============================================================================
VIM.MPACK                                                          *vim.mpack*

This module provides encoding and decoding of Lua objects to and from
msgpack-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.


vim.mpack.decode({str})                                   *vim.mpack.decode()*
    Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object.

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

    Return: ~
        (`any`)

vim.mpack.encode({obj})                                   *vim.mpack.encode()*
    Encodes (or "packs") Lua object {obj} as msgpack in a Lua string.

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

    Return: ~
        (`string`)


==============================================================================
VIM.JSON                                                            *vim.json*

This module provides encoding and decoding of Lua objects to and from
JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.


vim.json.decode({str}, {opts})                             *vim.json.decode()*
    Decodes (or "unpacks") the JSON-encoded {str} to a Lua object.
    • Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below).
    • Decodes empty object as |vim.empty_dict()|.
    • Decodes empty array as `{}` (empty Lua table).

    Example: >lua
        vim.print(vim.json.decode('{"bar":[],"foo":{},"zub":null}'))
        -- { bar = {}, foo = vim.empty_dict(), zub = vim.NIL }
<

    Parameters: ~
      • {str}   (`string`) Stringified JSON data.
      • {opts}  (`table<string,any>?`) Options table with keys:
                • luanil: (table) Table with keys:
                  • object: (boolean) When true, converts `null` in JSON
                    objects to Lua `nil` instead of |vim.NIL|.
                  • array: (boolean) When true, converts `null` in JSON arrays
                    to Lua `nil` instead of |vim.NIL|.

    Return: ~
        (`any`)

vim.json.encode({obj}, {opts})                             *vim.json.encode()*
    Encodes (or "packs") Lua object {obj} as JSON in a Lua string.

    Parameters: ~
      • {obj}   (`any`)
      • {opts}  (`table<string,any>?`) Options table with keys:
                • escape_slash: (boolean) (default false) Escape slash
                  characters "/" in string values.

    Return: ~
        (`string`)


==============================================================================
VIM.BASE64                                                        *vim.base64*

vim.base64.decode({str})                                 *vim.base64.decode()*
    Decode a Base64 encoded string.

    Parameters: ~
      • {str}  (`string`) Base64 encoded string

    Return: ~
        (`string`) Decoded string

vim.base64.encode({str})                                 *vim.base64.encode()*
    Encode {str} using Base64.

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

    Return: ~
        (`string`) Encoded string


==============================================================================
VIM.SPELL                        

Title: vim.mpack, vim.json, vim.base64: Encoding and Decoding Utilities
Summary
This section covers three modules: `vim.mpack`, `vim.json`, and `vim.base64`. `vim.mpack` provides functions to encode and decode Lua objects to and from msgpack-encoded strings. `vim.json` does the same for JSON, with options to control how JSON 'null' values are converted to Lua `nil`. `vim.base64` provides simple functions to encode strings using Base64 and decode Base64 encoded strings.