Home Explore Blog CI



neovim

17th chunk of `runtime/doc/api.txt`
0429e166e20e12ae9af787080fd27a1493d001ca3cab88f50000000100000fdb
      • 1: starts the paste (exactly once)
                 • 2: continues the paste (zero or more times)
                 • 3: ends the paste (exactly once)

    Return: ~
        • true: Client may continue pasting.
        • false: Client should cancel the paste.

nvim_put({lines}, {type}, {after}, {follow})                      *nvim_put()*
    Puts text at cursor, in any mode. For dot-repeatable input, use
    |nvim_paste()|.

    Compare |:put| and |p| which are always linewise.

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

    Parameters: ~
      • {lines}   |readfile()|-style list of lines. |channel-lines|
      • {type}    Edit behavior: any |getregtype()| result, or:
                  • "b" |blockwise-visual| mode (may include width, e.g. "b3")
                  • "c" |charwise| mode
                  • "l" |linewise| mode
                  • "" guess by contents, see |setreg()|
      • {after}   If true insert after cursor (like |p|), or before (like
                  |P|).
      • {follow}  If true place cursor at end of inserted text.

                                                    *nvim_replace_termcodes()*
nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
    Replaces terminal codes and |keycodes| (<CR>, <Esc>, ...) in a string with
    the internal representation.

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {str}        String to be converted.
      • {from_part}  Legacy Vim parameter. Usually true.
      • {do_lt}      Also translate <lt>. Ignored if `special` is false.
      • {special}    Replace |keycodes|, e.g. <CR> becomes a "\r" char.

    See also: ~
      • replace_termcodes
      • cpoptions

                                                *nvim_select_popupmenu_item()*
nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts})
    Selects an item in the completion popup menu.

    If neither |ins-completion| nor |cmdline-completion| popup menu is active
    this API call is silently ignored. Useful for an external UI using
    |ui-popupmenu| to control the popup menu with the mouse. Can also be used
    in a mapping; use <Cmd> |:map-cmd| or a Lua mapping to ensure the mapping
    doesn't end completion mode.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {item}    Index (zero-based) of the item to select. Value of -1
                  selects nothing and restores the original text.
      • {insert}  For |ins-completion|, whether the selection should be
                  inserted in the buffer. Ignored for |cmdline-completion|.
      • {finish}  Finish the completion and dismiss the popup menu. Implies
                  {insert}.
      • {opts}    Optional parameters. Reserved for future use.

                                                      *nvim_set_client_info()*
nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes})
    Self-identifies the client, and sets optional flags on the channel.
    Defines the `client` object returned by |nvim_get_chan_info()|.

    Clients should call this just after connecting, to provide hints for
    debugging and orchestration. (Note: Something is better than nothing!
    Fields are optional, but at least set `name`.)

    Can be called more than once; the caller should merge old info if
    appropriate. Example: library first identifies the channel, then a plugin
    using that library later identifies itself.

    Attributes: ~
        |RPC| only
        Since: 0.3.0

    Parameters: ~
      • {name}        Client short-name. Sets the `client.name` field of
                      |nvim_get_chan_info()|.
      • {version}     Dict describing the version, with these (optional) keys:
                      • "major" major version (defaults to 0 if not set, for
                        no release yet)
                      • "minor" minor version
                      • "patch" patch number
                      • "prerelease" string describing a

Title: Nvim API: Text Manipulation, Termcode Replacement, Popup Menu Selection, and Client Information
Summary
This section continues detailing the Nvim API, covering `nvim_put()` for inserting text at the cursor with various edit behaviors, `nvim_replace_termcodes()` for converting terminal codes and keycodes, `nvim_select_popupmenu_item()` for controlling the completion popup menu, and `nvim_set_client_info()` for identifying the client and setting channel flags.