Home Explore Blog CI



neovim

21th chunk of `runtime/doc/api.txt`
881bdd6820d175bb6dfe1e02b04546e136e81ef42a9db3b50000000100000fca
 except <buffer>, values are booleans (default false). Also:
                • "noremap" disables |recursive_mapping|, like |:noremap|
                • "desc" human-readable description.
                • "callback" Lua function called in place of {rhs}.
                • "replace_keycodes" (boolean) When "expr" is true, replace
                  keycodes in the resulting string (see
                  |nvim_replace_termcodes()|). Returning nil from the Lua
                  "callback" is equivalent to returning an empty string.

nvim_set_var({name}, {value})                                 *nvim_set_var()*
    Sets a global (g:) variable.

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {name}   Variable name
      • {value}  Variable value

nvim_set_vvar({name}, {value})                               *nvim_set_vvar()*
    Sets a v: variable, if it is not readonly.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {name}   Variable name
      • {value}  Variable value

nvim_strwidth({text})                                        *nvim_strwidth()*
    Calculates the number of display cells occupied by `text`. Control
    characters including <Tab> count as one cell.

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {text}  Some text

    Return: ~
        Number of cells

nvim__complete_set({index}, {opts})                     *nvim__complete_set()*
    EXPERIMENTAL: this API may change in the future.

    Sets info for the completion item at the given index. If the info text was
    shown in a window, returns the window and buffer ids, or empty dict if not
    shown.

    Parameters: ~
      • {index}  Completion candidate index
      • {opts}   Optional parameters.
                 • info: (string) info text.

    Return: ~
        Dict containing these keys:
        • winid: (number) floating window id
        • bufnr: (number) buffer id in floating window

nvim__get_runtime({pat}, {all}, {opts})                  *nvim__get_runtime()*
    Find files in runtime directories

    Attributes: ~
        |api-fast|
        Since: 0.6.0

    Parameters: ~
      • {pat}   pattern of files to search for
      • {all}   whether to return all matches or only the first
      • {opts}  is_lua: only search Lua subdirs

    Return: ~
        list of absolute paths to the found files

nvim__id({obj})                                                   *nvim__id()*
    Returns object given as argument.

    This API function is used for testing. One should not rely on its presence
    in plugins.

    Parameters: ~
      • {obj}  Object to return.

    Return: ~
        its argument.

nvim__id_array({arr})                                       *nvim__id_array()*
    Returns array given as argument.

    This API function is used for testing. One should not rely on its presence
    in plugins.

    Parameters: ~
      • {arr}  Array to return.

    Return: ~
        its argument.

nvim__id_dict({dct})                                         *nvim__id_dict()*
    Returns dict given as argument.

    This API function is used for testing. One should not rely on its presence
    in plugins.

    Parameters: ~
      • {dct}  Dict to return.

    Return: ~
        its argument.

nvim__id_float({flt})                                       *nvim__id_float()*
    Returns floating-point value given as argument.

    This API function is used for testing. One should not rely on its presence
    in plugins.

    Parameters: ~
      • {flt}  Value to return.

    Return: ~
        its argument.

nvim__inspect_cell({grid}, {row}, {col})                *nvim__inspect_cell()*
    NB: if your UI doesn't use hlstate, this will not return hlstate first
    time.

nvim__invalidate_glyph_cache()                *nvim__invalidate_glyph_cache()*
    For testing. The condition in schar_cache_clear_if_full is hard to reach,
    so this function can be used to force a cache clear in a test.

nvim__redraw({opts})      

Title: Nvim API: Variables, String Width, Completions, Runtime Files, and Testing Functions
Summary
This section documents the Nvim API functions for setting global and v: variables (`nvim_set_var`, `nvim_set_vvar`), calculating string width (`nvim_strwidth`), setting completion item info (`nvim__complete_set`), finding files in runtime directories (`nvim__get_runtime`), and several testing functions (`nvim__id`, `nvim__id_array`, `nvim__id_dict`, `nvim__id_float`, `nvim__inspect_cell`, `nvim__invalidate_glyph_cache`, and `nvim__redraw`). It includes parameter details and return values where applicable.