Home Explore Blog CI



neovim

25th chunk of `runtime/doc/api.txt`
a61e829f4940e5be7bf37f0329b95af2c8bd1a5f6709e1cf0000000100000fc4
 for "Register" nodes.
          • "cmp_type": String, comparison type, one of the value names from
            ExprComparisonType, stringified without "kExprCmp" prefix. Only
            present for "Comparison" nodes.
          • "ccs_strategy": String, case comparison strategy, one of the value
            names from ExprCaseCompareStrategy, stringified without
            "kCCStrategy" prefix. Only present for "Comparison" nodes.
          • "augmentation": String, augmentation type for "Assignment" nodes.
            Is either an empty string, "Add", "Subtract" or "Concat" for "=",
            "+=", "-=" or ".=" respectively.
          • "invert": Boolean, true if result of comparison needs to be
            inverted. Only present for "Comparison" nodes.
          • "ivalue": Integer, integer value for "Integer" nodes.
          • "fvalue": Float, floating-point value for "Float" nodes.
          • "svalue": String, value for "SingleQuotedString" and
            "DoubleQuotedString" nodes.


==============================================================================
Command Functions                                                *api-command*

                                              *nvim_buf_create_user_command()*
nvim_buf_create_user_command({buffer}, {name}, {command}, {opts})
    Creates a buffer-local command |user-commands|.

    Attributes: ~
        Since: 0.7.0

    Parameters: ~
      • {buffer}   Buffer id, or 0 for current buffer.

    See also: ~
      • nvim_create_user_command

                                                 *nvim_buf_del_user_command()*
nvim_buf_del_user_command({buffer}, {name})
    Delete a buffer-local user-defined command.

    Only commands created with |:command-buffer| or
    |nvim_buf_create_user_command()| can be deleted with this function.

    Attributes: ~
        Since: 0.7.0

    Parameters: ~
      • {buffer}  Buffer id, or 0 for current buffer.
      • {name}    Name of the command to delete.

nvim_buf_get_commands({buffer}, {opts})              *nvim_buf_get_commands()*
    Gets a map of buffer-local |user-commands|.

    Attributes: ~
        Since: 0.3.0

    Parameters: ~
      • {buffer}  Buffer id, or 0 for current buffer
      • {opts}    Optional parameters. Currently not used.

    Return: ~
        Map of maps describing commands.

nvim_cmd({cmd}, {opts})                                           *nvim_cmd()*
    Executes an Ex command.

    Unlike |nvim_command()| this command takes a structured Dict instead of a
    String. This allows for easier construction and manipulation of an Ex
    command. This also allows for things such as having spaces inside a
    command argument, expanding filenames in a command that otherwise doesn't
    expand filenames, etc. Command arguments may also be Number, Boolean or
    String.

    The first argument may also be used instead of count for commands that
    support it in order to make their usage simpler with |vim.cmd()|. For
    example, instead of `vim.cmd.bdelete{ count = 2 }`, you may do
    `vim.cmd.bdelete(2)`.

    On execution error: fails with Vimscript error, updates v:errmsg.

    Attributes: ~
        Since: 0.8.0

    Parameters: ~
      • {cmd}   Command to execute. Must be a Dict that can contain the same
                values as the return value of |nvim_parse_cmd()| except
                "addr", "nargs" and "nextcmd" which are ignored if provided.
                All values except for "cmd" are optional.
      • {opts}  Optional parameters.
                • output: (boolean, default false) Whether to return command
                  output.

    Return: ~
        Command output (non-error, non-shell |:!|) if `output` is true, else
        empty string.

    See also: ~
      • |nvim_exec2()|
      • |nvim_command()|

                                                  *nvim_create_user_command()*
nvim_create_user_command({name}, {command}, {opts})
    Creates a global |user-commands| command.


Title: API Command Functions: Buffer Commands and nvim_cmd
Summary
This section describes API functions related to commands in Neovim. It includes functions for creating, deleting, and retrieving buffer-local user commands (`nvim_buf_create_user_command`, `nvim_buf_del_user_command`, `nvim_buf_get_commands`). It also details the `nvim_cmd` function, which allows executing Ex commands using a structured dictionary for arguments, and the `nvim_create_user_command` function, for creating global user commands.