Home Explore Blog CI



neovim

9th chunk of `runtime/doc/api.txt`
8d69a22f9ff70bb78b4f6fe599c4c81bdb7e70bf1bb7d4b50000000100000fce

==============================================================================
Global Functions                                                  *api-global*

nvim_chan_send({chan}, {data})                              *nvim_chan_send()*
    Send data to channel `id`. For a job, it writes it to the stdin of the
    process. For the stdio channel |channel-stdio|, it writes to Nvim's
    stdout. For an internal terminal instance (|nvim_open_term()|) it writes
    directly to terminal output. See |channel-bytes| for more information.

    This function writes raw data, not RPC messages. If the channel was
    created with `rpc=true` then the channel expects RPC messages, use
    |vim.rpcnotify()| and |vim.rpcrequest()| instead.

    Attributes: ~
        |RPC| only
        Lua |vim.api| only
        Since: 0.5.0

    Parameters: ~
      • {chan}  id of the channel
      • {data}  data to write. 8-bit clean: can contain NUL bytes.

nvim_create_buf({listed}, {scratch})                       *nvim_create_buf()*
    Creates a new, empty, unnamed buffer.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {listed}   Sets 'buflisted'
      • {scratch}  Creates a "throwaway" |scratch-buffer| for temporary work
                   (always 'nomodified'). Also sets 'nomodeline' on the
                   buffer.

    Return: ~
        Buffer id, or 0 on error

    See also: ~
      • buf_open_scratch

nvim_del_current_line()                              *nvim_del_current_line()*
    Deletes the current line.

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

nvim_del_keymap({mode}, {lhs})                             *nvim_del_keymap()*
    Unmaps a global |mapping| for the given mode.

    To unmap a buffer-local mapping, use |nvim_buf_del_keymap()|.

    Attributes: ~
        Since: 0.4.0

    See also: ~
      • |nvim_set_keymap()|

nvim_del_mark({name})                                        *nvim_del_mark()*
    Deletes an uppercase/file named mark. See |mark-motions|.

    Note: ~
      • Lowercase name (or other buffer-local mark) is an error.

    Attributes: ~
        Since: 0.6.0

    Parameters: ~
      • {name}  Mark name

    Return: ~
        true if the mark was deleted, else false.

    See also: ~
      • |nvim_buf_del_mark()|
      • |nvim_get_mark()|

nvim_del_var({name})                                          *nvim_del_var()*
    Removes a global (g:) variable.

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {name}  Variable name

nvim_echo({chunks}, {history}, {opts})                           *nvim_echo()*
    Prints a message given by a list of `[text, hl_group]` "chunks".

    Example: >lua
        vim.api.nvim_echo({ { 'chunk1-line1\nchunk1-line2\n' }, { 'chunk2-line1' } }, true, {})
<

    Attributes: ~
        Since: 0.5.0

    Parameters: ~
      • {chunks}   List of `[text, hl_group]` pairs, where each is a `text`
                   string highlighted by the (optional) name or ID `hl_group`.
      • {history}  if true, add to |message-history|.
      • {opts}     Optional parameters.
                   • err: Treat the message like `:echoerr`. Sets `hl_group`
                     to |hl-ErrorMsg| by default.
                   • kind: Set the |ui-messages| kind with which this message
                     will be emitted.
                   • verbose: Message is controlled by the 'verbose' option.
                     Nvim invoked with `-V3log` will write the message to the
                     "log" file instead of standard output.

nvim_eval_statusline({str}, {opts})                   *nvim_eval_statusline()*
    Evaluates statusline string.

    Attributes: ~
        |api-fast|
        Since: 0.6.0

    Parameters: ~
      • {str}   Statusline string (see 'statusline').
      • {opts}  Optional parameters.
                • winid: (number) |window-ID| of the window to use as context
                  for statusline.
                • maxwidth:

Title: Nvim API: Global Functions (Continued)
Summary
This section details several global functions available in the Nvim API, including: `nvim_chan_send()` for sending data to a channel; `nvim_create_buf()` for creating a new, empty buffer; `nvim_del_current_line()` for deleting the current line; `nvim_del_keymap()` for unmapping global keymaps; `nvim_del_mark()` for deleting uppercase/file-named marks; `nvim_del_var()` for removing global variables; `nvim_echo()` for printing messages with highlighting; and `nvim_eval_statusline()` for evaluating statusline strings.