Home Explore Blog CI



neovim

52th chunk of `runtime/doc/api.txt`
f35a0668bdb983c3e230c82d3a461f11769ef1073e3c354f0000000100000d52
 number
                   |autocmd-buflocal|. Cannot be used with {pattern}.
                 • modeline (bool) optional: defaults to true. Process the
                   modeline after the autocommands <nomodeline>.
                 • data (any): arbitrary data to send to the autocommand
                   callback. See |nvim_create_autocmd()| for details.

    See also: ~
      • |:doautocmd|

nvim_get_autocmds({opts})                                *nvim_get_autocmds()*
    Get all autocommands that match the corresponding {opts}.

    These examples will get autocommands matching ALL the given criteria: >lua
        -- Matches all criteria
        autocommands = vim.api.nvim_get_autocmds({
          group = 'MyGroup',
          event = {'BufEnter', 'BufWinEnter'},
          pattern = {'*.c', '*.h'}
        })

        -- All commands from one group
        autocommands = vim.api.nvim_get_autocmds({
          group = 'MyGroup',
        })
<

    NOTE: When multiple patterns or events are provided, it will find all the
    autocommands that match any combination of them.

    Attributes: ~
        Since: 0.7.0

    Parameters: ~
      • {opts}  Dict with at least one of the following:
                • buffer: (integer) Buffer number or list of buffer numbers
                  for buffer local autocommands |autocmd-buflocal|. Cannot be
                  used with {pattern}
                • event: (string|table) event or events to match against
                  |autocmd-events|.
                • id: (integer) Autocommand ID to match.
                • group: (string|table) the autocommand group name or id to
                  match against.
                • pattern: (string|table) pattern or patterns to match against
                  |autocmd-pattern|. Cannot be used with {buffer}

    Return: ~
        Array of autocommands matching the criteria, with each item containing
        the following fields:
        • buffer: (integer) the buffer number.
        • buflocal: (boolean) true if the autocommand is buffer local.
        • command: (string) the autocommand command. Note: this will be empty
          if a callback is set.
        • callback: (function|string|nil): Lua function or name of a Vim
          script function which is executed when this autocommand is
          triggered.
        • desc: (string) the autocommand description.
        • event: (string) the autocommand event.
        • id: (integer) the autocommand id (only when defined with the API).
        • group: (integer) the autocommand group id.
        • group_name: (string) the autocommand group name.
        • once: (boolean) whether the autocommand is only run once.
        • pattern: (string) the autocommand pattern. If the autocommand is
          buffer local |autocmd-buffer-local|:


==============================================================================
UI Functions                                                          *api-ui*

nvim_ui_attach({width}, {height}, {options})                *nvim_ui_attach()*
    Activates UI events on the channel.

    Entry point of all UI clients. Allows |--embed| to continue startup.
    Implies that the client is ready to show the UI. Adds the client to the
    list of UIs. |nvim_list_uis()|

    Note: ~
      • If multiple UI clients are attached, the global screen dimensions

Title: Neovim API: Autocommand Retrieval and UI Attachment
Summary
This section details the `nvim_get_autocmds` function, which retrieves autocommands based on specified criteria such as buffer, event, ID, group, or pattern, returning an array of autocommand details. It also introduces `nvim_ui_attach`, which activates UI events on the channel and signals that the client is ready to display the UI, serving as the entry point for UI clients.