Home Explore Blog CI



neovim

15th chunk of `runtime/doc/api.txt`
7cf9c31a2b3fbb4ad04b5ad5fe1fc32103d1f1a60bacc7be0000000100000fb2
 column-position (zero-based, like redraw events)

nvim_list_bufs()                                            *nvim_list_bufs()*
    Gets the current list of buffers.

    Includes unlisted (unloaded/deleted) buffers, like `:ls!`. Use
    |nvim_buf_is_loaded()| to check if a buffer is loaded.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        List of buffer ids

nvim_list_chans()                                          *nvim_list_chans()*
    Get information about all open channels.

    Attributes: ~
        Since: 0.3.0

    Return: ~
        Array of Dictionaries, each describing a channel with the format
        specified at |nvim_get_chan_info()|.

nvim_list_runtime_paths()                          *nvim_list_runtime_paths()*
    Gets the paths contained in |runtime-search-path|.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        List of paths

nvim_list_tabpages()                                    *nvim_list_tabpages()*
    Gets the current list of |tab-ID|s.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        List of |tab-ID|s

nvim_list_uis()                                              *nvim_list_uis()*
    Gets a list of dictionaries representing attached UIs.

    Example: The Nvim builtin |TUI| sets its channel info as described in
    |startup-tui|. In particular, it sets `client.name` to "nvim-tui". So you
    can check if the TUI is running by inspecting the client name of each UI: >lua
        vim.print(vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan).client.name)
<

    Attributes: ~
        Since: 0.3.0

    Return: ~
        Array of UI dictionaries, each with these keys:
        • "height" Requested height of the UI
        • "width" Requested width of the UI
        • "rgb" true if the UI uses RGB colors (false implies |cterm-colors|)
        • "ext_..." Requested UI extensions, see |ui-option|
        • "chan" |channel-id| of remote UI

nvim_list_wins()                                            *nvim_list_wins()*
    Gets the current list of all |window-ID|s in all tabpages.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        List of |window-ID|s

nvim_load_context({dict})                                *nvim_load_context()*
    Sets the current editor state from the given |context| map.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {dict}  |Context| map.

nvim_open_term({buffer}, {opts})                            *nvim_open_term()*
    Open a terminal instance in a buffer

    By default (and currently the only option) the terminal will not be
    connected to an external process. Instead, input sent on the channel will
    be echoed directly by the terminal. This is useful to display ANSI
    terminal sequences returned as part of an RPC message, or similar.

    Note: to directly initiate the terminal using the right size, display the
    buffer in a configured window before calling this. For instance, for a
    floating display, first create an empty buffer using |nvim_create_buf()|,
    then display it using |nvim_open_win()|, and then call this function. Then
    |nvim_chan_send()| can be called immediately to process sequences in a
    virtual terminal having the intended size.

    Example: this `TermHl` command can be used to display and highlight raw
    ANSI termcodes, so you can use Nvim as a "scrollback pager" (for terminals
    like kitty):                     *ansi-colorize* *terminal-scrollback-pager* >lua
        vim.api.nvim_create_user_command('TermHl', function()
          vim.api.nvim_open_term(0, {})
        end, { desc = 'Highlights ANSI termcodes in curbuf' })
<

    Attributes: ~
        not allowed when |textlock| is active
        Since: 0.5.0

    Parameters: ~
      • {buffer}  Buffer to use. Buffer contents (if any) will be written to
                  the PTY.
      • {opts}    Optional parameters.
                  • on_input: Lua callback for input sent, i e keypresses in
                   

Title: Nvim API: Listing Buffers, Channels, Paths, Tabpages, UIs, Windows, Loading Context, and Opening Terminals
Summary
This section details Nvim API functions for listing various editor components such as buffers (`nvim_list_bufs()`), channels (`nvim_list_chans()`), runtime paths (`nvim_list_runtime_paths()`), tabpages (`nvim_list_tabpages()`), UIs (`nvim_list_uis()`), and windows (`nvim_list_wins()`). It also covers functions for loading editor context (`nvim_load_context()`) and opening terminal instances within a buffer (`nvim_open_term()`).