Home Explore Blog CI



neovim

13th chunk of `runtime/doc/lua.txt`
12ca4b3dcecf0d1e2814fffad5c2b3e782a5152e77e226c40000000100000fb2
 whether empty Lua
    table represents empty list or empty array) and forcing integral numbers
    to be |Float|. See |lua-special-tbl| for more details.

vim.val_idx                                                      *vim.val_idx*
    Value index for tables representing |Float|s. A table representing
    floating-point value 1.0 looks like this: >lua
        {
          [vim.type_idx] = vim.types.float,
          [vim.val_idx] = 1.0,
        }
<    See also |vim.type_idx| and |lua-special-tbl|.

vim.types                                                          *vim.types*
    Table with possible values for |vim.type_idx|. Contains two sets of
    key-value pairs: first maps possible values for |vim.type_idx| to
    human-readable strings, second maps human-readable type names to values
    for |vim.type_idx|. Currently contains pairs for `float`, `array` and
        `dictionary` types.

    Note: One must expect that values corresponding to `vim.types.float`,
    `vim.types.array` and `vim.types.dictionary` fall under only two following
    assumptions:
    1. Value may serve both as a key and as a value in a table. Given the
       properties of Lua tables this basically means “value is not `nil`”.
    2. For each value in `vim.types` table `vim.types[vim.types[value]]` is the
       same as `value`.
    No other restrictions are put on types, and it is not guaranteed that
    values corresponding to `vim.types.float`, `vim.types.array` and
    `vim.types.dictionary` will not change or that `vim.types` table will only
    contain values for these three types.

                                                   *log_levels* *vim.log.levels*
Log levels are one of the values defined in `vim.log.levels`:

    vim.log.levels.DEBUG
    vim.log.levels.ERROR
    vim.log.levels.INFO
    vim.log.levels.TRACE
    vim.log.levels.WARN
    vim.log.levels.OFF



vim.empty_dict()                                            *vim.empty_dict()*
    Creates a special empty table (marked with a metatable), which Nvim
    converts to an empty dictionary when translating Lua values to Vimscript
    or API types. Nvim by default converts an empty table `{}` without this
    metatable to an list/array.

    Note: If numeric keys are present in the table, Nvim ignores the metatable
    marker and converts the dict to a list/array anyway.

    Return: ~
        (`table`)

vim.iconv({str}, {from}, {to})                                   *vim.iconv()*
    The result is a String, which is the text {str} converted from encoding
    {from} to encoding {to}. When the conversion fails `nil` is returned. When
    some characters could not be converted they are replaced with "?". The
    encoding names are whatever the iconv() library function can accept, see
    ":Man 3 iconv".

    Parameters: ~
      • {str}   (`string`) Text to convert
      • {from}  (`string`) Encoding of {str}
      • {to}    (`string`) Target encoding

    Return: ~
        (`string?`) Converted string if conversion succeeds, `nil` otherwise.

vim.in_fast_event()                                      *vim.in_fast_event()*
    Returns true if the code is executing as part of a "fast" event handler,
    where most of the API is disabled. These are low-level events (e.g.
    |lua-loop-callbacks|) which can be invoked whenever Nvim polls for input.
    When this is `false` most API functions are callable (but may be subject
    to other restrictions such as |textlock|).

vim.rpcnotify({channel}, {method}, {...})                    *vim.rpcnotify()*
    Sends {event} to {channel} via |RPC| and returns immediately. If {channel}
    is 0, the event is broadcast to all channels.

    This function also works in a fast callback |lua-loop-callbacks|.

    Parameters: ~
      • {channel}  (`integer`)
      • {method}   (`string`)
      • {...}      (`any?`)

vim.rpcrequest({channel}, {method}, {...})                  *vim.rpcrequest()*
    Sends a request to {channel} to invoke {method} via |RPC|

Title: vim.builtin Continued: Type Handling, Logging, and RPC Functions
Summary
This section continues the description of the `vim.builtin` module, detailing functions and tables for type handling such as `vim.type_idx`, `vim.val_idx`, and `vim.types`. It also explains the `vim.log.levels` used for logging, `vim.empty_dict()` for creating empty dictionaries, `vim.iconv()` for encoding conversion, `vim.in_fast_event()` for checking fast event handlers, `vim.rpcnotify()` for sending RPC notifications, and `vim.rpcrequest()` for sending RPC requests.