Home Explore Blog CI



neovim

11th chunk of `runtime/doc/api.txt`
2ac05557aa0199d67866f8f4630743c15e7df0db9b953d600000000100000fd4

    Sends input-keys to Nvim, subject to various quirks controlled by `mode`
    flags. This is a blocking call, unlike |nvim_input()|.

    On execution error: does not fail, but updates v:errmsg.

    To input sequences like <C-o> use |nvim_replace_termcodes()| (typically
    with escape_ks=false) to replace |keycodes|, then pass the result to
    nvim_feedkeys().

    Example: >vim
        :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
        :call nvim_feedkeys(key, 'n', v:false)
<

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {keys}       to be typed
      • {mode}       behavior flags, see |feedkeys()|
      • {escape_ks}  If true, escape K_SPECIAL bytes in `keys`. This should be
                     false if you already used |nvim_replace_termcodes()|, and
                     true otherwise.

    See also: ~
      • feedkeys()
      • vim_strsave_escape_ks

nvim_get_api_info()                                      *nvim_get_api_info()*
    Returns a 2-tuple (Array), where item 0 is the current channel id and item
    1 is the |api-metadata| map (Dict).

    Attributes: ~
        |api-fast|
        |RPC| only
        Since: 0.1.0

    Return: ~
        2-tuple `[{channel-id}, {api-metadata}]`

nvim_get_chan_info({chan})                              *nvim_get_chan_info()*
    Gets information about a channel.

    See |nvim_list_uis()| for an example of how to get channel info.

    Attributes: ~
        Since: 0.3.0

    Parameters: ~
      • {chan}  channel_id, or 0 for current channel

    Return: ~
        Channel info dict with these keys:
        • "id" Channel id.
        • "argv" (optional) Job arguments list.
        • "stream" Stream underlying the channel.
          • "stdio" stdin and stdout of this Nvim instance
          • "stderr" stderr of this Nvim instance
          • "socket" TCP/IP socket or named pipe
          • "job" Job with communication over its stdio.
        • "mode" How data received on the channel is interpreted.
          • "bytes" Send and receive raw bytes.
          • "terminal" |terminal| instance interprets ASCII sequences.
          • "rpc" |RPC| communication on the channel is active.
        • "pty" (optional) Name of pseudoterminal. On a POSIX system this is a
          device path like "/dev/pts/1". If unknown, the key will still be
          present if a pty is used (e.g. for conpty on Windows).
        • "buffer" (optional) Buffer connected to |terminal| instance.
        • "client" (optional) Info about the peer (client on the other end of
          the channel), as set by |nvim_set_client_info()|.

nvim_get_color_by_name({name})                      *nvim_get_color_by_name()*
    Returns the 24-bit RGB value of a |nvim_get_color_map()| color name or
    "#rrggbb" hexadecimal string.

    Example: >vim
        :echo nvim_get_color_by_name("Pink")
        :echo nvim_get_color_by_name("#cbcbcb")
<

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {name}  Color name or "#rrggbb" string

    Return: ~
        24-bit RGB value, or -1 for invalid argument.

nvim_get_color_map()                                    *nvim_get_color_map()*
    Returns a map of color names and RGB values.

    Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values
    (e.g. 65535).

    Attributes: ~
        Since: 0.1.0

    Return: ~
        Map of color names and RGB values.

nvim_get_context({opts})                                  *nvim_get_context()*
    Gets a map of the current editor state.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {opts}  Optional parameters.
                • types: List of |context-types| ("regs", "jumps", "bufs",
                  "gvars", …) to gather, or empty for "all".

    Return: ~
        map of global |context|.

nvim_get_current_buf()                                *nvim_get_current_buf()*
    Gets the current buffer.

    Attributes: ~
        Since: 0.1.0

    Return:

Title: Nvim API: Global Functions - Input, Info, Channels, Colors, and Context
Summary
This section details global functions in the Nvim API related to input (`nvim_feedkeys()`), retrieving information (`nvim_get_api_info()`, `nvim_get_chan_info()`, `nvim_get_color_by_name()`, `nvim_get_color_map()`, `nvim_get_context()`), and managing the current buffer (`nvim_get_current_buf()`).