#include <assert.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "nvim/api/buffer.h"
#include "nvim/api/deprecated.h"
#include "nvim/api/private/converter.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/dispatch.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/api/window.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/context.h"
#include "nvim/decoration.h"
#include "nvim/decoration_provider.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h"
#include "nvim/file_search.h"
#include "nvim/fileio.h"
#include "nvim/getchar.h"
#include "nvim/globals.h"
#include "nvim/highlight.h"
#include "nvim/highlight_defs.h"
#include "nvim/highlight_group.h"
#include "nvim/lua/executor.h"
#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/move.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/ops.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/process.h"
#include "nvim/popupmnu.h"
#include "nvim/screen.h"
#include "nvim/state.h"
#include "nvim/types.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
#include "nvim/viml/parser/expressions.h"
#include "nvim/viml/parser/parser.h"
#include "nvim/window.h"
Macros | |
#define | LINE_BUFFER_SIZE 4096 |
#define | PUSH_CHAR(i, pos, line_buf, msg) |
Functions | |
Dictionary | nvim_get_hl_by_name (String name, Boolean rgb, Error *err) FUNC_API_SINCE(3) |
Dictionary | nvim_get_hl_by_id (Integer hl_id, Boolean rgb, Error *err) FUNC_API_SINCE(3) |
Integer | nvim_get_hl_id_by_name (String name) FUNC_API_SINCE(7) |
Dictionary | nvim__get_hl_defs (Integer ns_id, Error *err) |
void | nvim_set_hl (Integer ns_id, String name, Dict(highlight) *val, Error *err) FUNC_API_SINCE(7) |
void | nvim__set_hl_ns (Integer ns_id, Error *err) FUNC_API_FAST |
void | nvim_feedkeys (String keys, String mode, Boolean escape_ks) FUNC_API_SINCE(1) |
Integer | nvim_input (String keys) FUNC_API_SINCE(1) FUNC_API_FAST |
void | nvim_input_mouse (String button, String action, String modifier, Integer grid, Integer row, Integer col, Error *err) FUNC_API_SINCE(6) FUNC_API_FAST |
String | nvim_replace_termcodes (String str, Boolean from_part, Boolean do_lt, Boolean special) FUNC_API_SINCE(1) |
Object | nvim_exec_lua (String code, Array args, Error *err) FUNC_API_REMOTE_ONLY |
Object | nvim_notify (String msg, Integer log_level, Dictionary opts, Error *err) FUNC_API_SINCE(7) |
Integer | nvim_strwidth (String text, Error *err) FUNC_API_SINCE(1) |
ArrayOf (String) | |
Array | nvim__runtime_inspect (void) |
String | nvim__get_lib_dir (void) |
void | nvim_set_current_dir (String dir, Error *err) FUNC_API_SINCE(1) |
String | nvim_get_current_line (Error *err) FUNC_API_SINCE(1) |
void | nvim_set_current_line (String line, Error *err) FUNC_API_CHECK_TEXTLOCK |
void | nvim_del_current_line (Error *err) FUNC_API_CHECK_TEXTLOCK |
Object | nvim_get_var (String name, Error *err) FUNC_API_SINCE(1) |
void | nvim_set_var (String name, Object value, Error *err) FUNC_API_SINCE(1) |
void | nvim_del_var (String name, Error *err) FUNC_API_SINCE(1) |
Object | nvim_get_vvar (String name, Error *err) FUNC_API_SINCE(1) |
void | nvim_set_vvar (String name, Object value, Error *err) FUNC_API_SINCE(6) |
Object | nvim_get_option (String name, Error *err) FUNC_API_SINCE(1) |
Object | nvim_get_option_value (String name, Dict(option) *opts, Error *err) FUNC_API_SINCE(9) |
void | nvim_set_option_value (String name, Object value, Dict(option) *opts, Error *err) FUNC_API_SINCE(9) |
Dictionary | nvim_get_all_options_info (Error *err) FUNC_API_SINCE(7) |
Dictionary | nvim_get_option_info (String name, Error *err) FUNC_API_SINCE(7) |
void | nvim_set_option (uint64_t channel_id, String name, Object value, Error *err) FUNC_API_SINCE(1) |
void | nvim_echo (Array chunks, Boolean history, Dictionary opts, Error *err) FUNC_API_SINCE(7) |
void | nvim_out_write (String str) FUNC_API_SINCE(1) |
void | nvim_err_write (String str) FUNC_API_SINCE(1) |
void | nvim_err_writeln (String str) FUNC_API_SINCE(1) |
ArrayOf (Buffer) | |
Buffer | nvim_get_current_buf (void) |
void | nvim_set_current_buf (Buffer buffer, Error *err) FUNC_API_CHECK_TEXTLOCK |
ArrayOf (Window) | |
Window | nvim_get_current_win (void) |
void | nvim_set_current_win (Window window, Error *err) FUNC_API_CHECK_TEXTLOCK |
Buffer | nvim_create_buf (Boolean listed, Boolean scratch, Error *err) FUNC_API_SINCE(6) |
Integer | nvim_open_term (Buffer buffer, DictionaryOf(LuaRef) opts, Error *err) FUNC_API_SINCE(7) |
void | nvim_chan_send (Integer chan, String data, Error *err) FUNC_API_SINCE(7) FUNC_API_REMOTE_ONLY FUNC_API_LUA_ONLY |
ArrayOf (Tabpage) | |
Tabpage | nvim_get_current_tabpage (void) |
void | nvim_set_current_tabpage (Tabpage tabpage, Error *err) FUNC_API_CHECK_TEXTLOCK |
Boolean | nvim_paste (String data, Boolean crlf, Integer phase, Error *err) FUNC_API_CHECK_TEXTLOCK |
void | nvim_put (ArrayOf(String) lines, String type, Boolean after, Boolean follow, Error *err) FUNC_API_CHECK_TEXTLOCK |
void | nvim_subscribe (uint64_t channel_id, String event) FUNC_API_SINCE(1) FUNC_API_REMOTE_ONLY |
void | nvim_unsubscribe (uint64_t channel_id, String event) FUNC_API_SINCE(1) FUNC_API_REMOTE_ONLY |
Integer | nvim_get_color_by_name (String name) FUNC_API_SINCE(1) |
Dictionary | nvim_get_color_map (void) |
Dictionary | nvim_get_context (Dict(context) *opts, Error *err) FUNC_API_SINCE(6) |
Object | nvim_load_context (Dictionary dict) FUNC_API_SINCE(6) |
Dictionary | nvim_get_mode (void) |
ArrayOf (Dictionary) | |
void | nvim_set_keymap (uint64_t channel_id, String mode, String lhs, String rhs, Dict(keymap) *opts, Error *err) FUNC_API_SINCE(6) |
void | nvim_del_keymap (uint64_t channel_id, String mode, String lhs, Error *err) FUNC_API_SINCE(6) |
Dictionary | nvim_get_commands (Dict(get_commands) *opts, Error *err) FUNC_API_SINCE(4) |
Array | nvim_get_api_info (uint64_t channel_id) FUNC_API_SINCE(1) FUNC_API_FAST FUNC_API_REMOTE_ONLY |
void | nvim_set_client_info (uint64_t channel_id, String name, Dictionary version, String type, Dictionary methods, Dictionary attributes, Error *err) FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY |
Dictionary | nvim_get_chan_info (Integer chan, Error *err) FUNC_API_SINCE(4) |
Array | nvim_list_chans (void) |
Array | nvim_call_atomic (uint64_t channel_id, Array calls, Error *err) FUNC_API_SINCE(1) FUNC_API_REMOTE_ONLY |
Object | nvim__id (Object obj) |
Array | nvim__id_array (Array arr) |
Dictionary | nvim__id_dictionary (Dictionary dct) |
Float | nvim__id_float (Float flt) |
Dictionary | nvim__stats (void) |
Array | nvim_list_uis (void) |
Array | nvim_get_proc_children (Integer pid, Error *err) FUNC_API_SINCE(4) |
Object | nvim_get_proc (Integer pid, Error *err) FUNC_API_SINCE(4) |
void | nvim_select_popupmenu_item (Integer item, Boolean insert, Boolean finish, Dictionary opts, Error *err) FUNC_API_SINCE(6) |
Array | nvim__inspect_cell (Integer grid, Integer row, Integer col, Error *err) |
NB: if your UI doesn't use hlstate, this will not return hlstate first time. More... | |
void | nvim__screenshot (String path) FUNC_API_FAST |
Boolean | nvim_del_mark (String name, Error *err) FUNC_API_SINCE(8) |
Array | nvim_get_mark (String name, Dictionary opts, Error *err) FUNC_API_SINCE(8) |
Dictionary | nvim_eval_statusline (String str, Dict(eval_statusline) *opts, Error *err) FUNC_API_SINCE(8) FUNC_API_FAST |
void | nvim_create_user_command (String name, Object command, Dict(user_command) *opts, Error *err) FUNC_API_SINCE(9) |
void | nvim_del_user_command (String name, Error *err) FUNC_API_SINCE(9) |
#define LINE_BUFFER_SIZE 4096 |
ArrayOf | ( | Buffer | ) |
Gets the current list of buffer handles
Includes unlisted (unloaded/deleted) buffers, like :ls!
. Use |nvim_buf_is_loaded()| to check if a buffer is loaded.
ArrayOf | ( | Dictionary | ) |
Gets a list of global (non-buffer-local) |mapping| definitions.
mode | Mode short-name ("n", "i", "v", ...) |
ArrayOf | ( | String | ) |
Gets the paths contained in 'runtimepath'.
Find files in runtime directories
'name' can contain wildcards. For example nvim_get_runtime_file("colors/*.vim", true) will return all color scheme files. Always use forward slashes (/) in the search pattern for subdirectories regardless of platform.
It is not an error to not find any files. An empty array is returned then.
name | pattern of files to search for |
all | whether to return all matches or only the first |
Find files in runtime directories
pat | pattern of files to search for |
all | whether to return all matches or only the first |
opts | is_lua: only search lua subdirs |
ArrayOf | ( | Tabpage | ) |
Gets the current list of tabpage handles.
ArrayOf | ( | Window | ) |
Gets the current list of window handles.
Dictionary nvim__get_hl_defs | ( | Integer | ns_id, |
Error * | err | ||
) |
Returns object given as argument.
This API function is used for testing. One should not rely on its presence in plugins.
[in] | obj | Object to return. |
Returns array given as argument.
This API function is used for testing. One should not rely on its presence in plugins.
[in] | arr | Array to return. |
Dictionary nvim__id_dictionary | ( | Dictionary | dct | ) |
Returns dictionary given as argument.
This API function is used for testing. One should not rely on its presence in plugins.
[in] | dct | Dictionary to return. |
Returns floating-point value given as argument.
This API function is used for testing. One should not rely on its presence in plugins.
[in] | flt | Value to return. |
NB: if your UI doesn't use hlstate, this will not return hlstate first time.
Set active namespace for highlights.
NB: this function can be called from async contexts, but the semantics are not yet well-defined. To start with |nvim_set_decoration_provider| on_win and on_line callbacks are explicitly allowed to change the namespace during a redraw cycle.
ns_id | the namespace to activate | |
[out] | err | Error details, if any |
Dictionary nvim__stats | ( | void | ) |
Gets internal stats.
Calls many API methods atomically.
This has two main usages:
channel_id | ||
calls | an array of calls, where each call is described by an array with two elements: the request name, and an array of arguments. | |
[out] | err | Validation error details (malformed calls parameter), if any. Errors from batched calls are given in the return value. |
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.
chan | id of the channel | |
data | data to write. 8-bit clean: can contain NUL bytes. | |
[out] | err | Error details, if any |
Creates a new, empty, unnamed buffer.
listed | Sets 'buflisted' | |
scratch | Creates a "throwaway" |scratch-buffer| for temporary work (always 'nomodified'). Also sets 'nomodeline' on the buffer. | |
[out] | err | Error details, if any |
void nvim_create_user_command | ( | String | name, |
Object | command, | ||
Dict(user_command) * | opts, | ||
Error * | err | ||
) |
Create a new user command |user-commands|
{name} is the name of the new command. The name must begin with an uppercase letter.
{command} is the replacement text or Lua function to execute.
Example:
:call nvim_create_user_command('SayHello', 'echo "Hello world!"', {}) :SayHello Hello world!
name | Name of the new user command. Must begin with an uppercase letter. | |
command | Replacement command to execute when this user command is executed. When called from Lua, the command can also be a Lua function. The function is called with a single table argument that contains the following keys:
| |
opts | Optional command attributes. See |command-attributes| for more details. To use boolean attributes (such as |:command-bang| or |:command-bar|) set the value to "true". In addition to the string options listed in |:command-complete|, the "complete" key also accepts a Lua function which works like the "customlist" completion mode |:command-completion-customlist|. Additional parameters:
| |
[out] | err | Error details, if any. |
Deletes the current line.
[out] | err | Error details, if any |
Unmaps a global |mapping| for the given mode.
To unmap a buffer-local mapping, use |nvim_buf_del_keymap()|.
Deletes an uppercase/file named mark. See |mark-motions|.
name | Mark name |
Delete a user-defined command.
name | Name of the command to delete. | |
[out] | err | Error details, if any. |
Removes a global (g:) variable.
name | Variable name | |
[out] | err | Error details, if any |
void nvim_echo | ( | Array | chunks, |
Boolean | history, | ||
Dictionary | opts, | ||
Error * | err | ||
) |
Echo a message.
chunks | A list of [text, hl_group] arrays, each representing a text chunk with specified highlight. hl_group element can be omitted for no highlight. |
history | if true, add to |message-history|. |
opts | Optional parameters. Reserved for future use. |
Writes a message to the Vim error buffer. Does not append "\n", the message is buffered (won't display) until a linefeed is written.
str | Message |
Writes a message to the Vim error buffer. Appends "\n", so the buffer is flushed (and displayed).
str | Message |
Dictionary nvim_eval_statusline | ( | String | str, |
Dict(eval_statusline) * | opts, | ||
Error * | err | ||
) |
Evaluates statusline string.
str | Statusline string (see 'statusline'). | |
opts | Optional parameters.
| |
[out] | err | Error details, if any. |
Execute Lua code. Parameters (if any) are available as ...
inside the chunk. The chunk can return a value.
Only statements are executed. To evaluate an expression, prefix it with return
: return my_function(...)
code | Lua code to execute | |
args | Arguments to the code | |
[out] | err | Details of an error encountered while parsing or executing the Lua code. |
Sends input-keys to Nvim, subject to various quirks controlled by mode
flags. This is a blocking call, unlike |nvim_input()|.
On execution error: does not fail, but updates v:errmsg.
To input sequences like <C-o> use |nvim_replace_termcodes()| (typically with escape_ks=false) to replace |keycodes|, then pass the result to nvim_feedkeys().
Example:
:let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true) :call nvim_feedkeys(key, 'n', v:false)
keys | to be typed |
mode | behavior flags, see |feedkeys()| |
escape_ks | If true, escape K_SPECIAL bytes in keys This should be false if you already used |nvim_replace_termcodes()|, and true otherwise. |
Dictionary nvim_get_all_options_info | ( | Error * | err | ) |
Gets the option information for all options.
The dictionary has the full option names as keys and option metadata dictionaries as detailed at |nvim_get_option_info|.
Array nvim_get_api_info | ( | uint64_t | channel_id | ) |
Returns a 2-tuple (Array), where item 0 is the current channel id and item 1 is the |api-metadata| map (Dictionary).
Dictionary nvim_get_chan_info | ( | Integer | chan, |
Error * | err | ||
) |
Gets information about a channel.
Returns the 24-bit RGB value of a |nvim_get_color_map()| color name or "#rrggbb" hexadecimal string.
Example:
:echo nvim_get_color_by_name("Pink") :echo nvim_get_color_by_name("#cbcbcb")
name | Color name or "#rrggbb" string |
Dictionary nvim_get_color_map | ( | void | ) |
Returns a map of color names and RGB values.
Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values (e.g. 65535).
Dictionary nvim_get_commands | ( | Dict(get_commands) * | opts, |
Error * | err | ||
) |
Gets a map of global (non-buffer-local) Ex commands.
Currently only |user-commands| are supported, not builtin Ex commands.
opts | Optional parameters. Currently only supports {"builtin":false} | |
[out] | err | Error details, if any. |
Dictionary nvim_get_context | ( | Dict(context) * | opts, |
Error * | err | ||
) |
Gets a map of the current editor state.
opts | Optional parameters.
| |
[out] | err | Error details, if any |
Buffer nvim_get_current_buf | ( | void | ) |
Gets the current buffer.
Tabpage nvim_get_current_tabpage | ( | void | ) |
Gets the current tabpage.
Window nvim_get_current_win | ( | void | ) |
Gets the current window.
Dictionary nvim_get_hl_by_id | ( | Integer | hl_id, |
Boolean | rgb, | ||
Error * | err | ||
) |
Gets a highlight definition by id. |hlID()|
hl_id | Highlight id as returned by |hlID()| | |
rgb | Export RGB colors | |
[out] | err | Error details, if any |
Dictionary nvim_get_hl_by_name | ( | String | name, |
Boolean | rgb, | ||
Error * | err | ||
) |
Gets a highlight definition by name.
name | Highlight group name | |
rgb | Export RGB colors | |
[out] | err | Error details, if any |
Gets a highlight group by name
similar to |hlID()|, but allocates a new ID if not present.
Array nvim_get_mark | ( | String | name, |
Dictionary | opts, | ||
Error * | err | ||
) |
Return a tuple (row, col, buffer, buffername) representing the position of the uppercase/file named mark. See |mark-motions|.
Marks are (1,0)-indexed. |api-indexing|
name | Mark name |
opts | Optional parameters. Reserved for future use. |
Dictionary nvim_get_mode | ( | void | ) |
Gets the current mode. |mode()| "blocking" is true if Nvim is waiting for input.
Gets the global value of an option.
name | Option name | |
[out] | err | Error details, if any |
Dictionary nvim_get_option_info | ( | String | name, |
Error * | err | ||
) |
Gets the option information for one option
Resulting dictionary has keys:
name | Option name | |
[out] | err | Error details, if any |
Gets the value of an option. The behavior of this function matches that of |:set|: the local value of an option is returned if it exists; otherwise, the global value is returned. Local values always correspond to the current buffer or window. To get a buffer-local or window-local option for a specific buffer or window, use |nvim_buf_get_option()| or |nvim_win_get_option()|.
name | Option name | |
opts | Optional parameters
| |
[out] | err | Error details, if any |
Gets info describing process pid
.
Gets the immediate children of process pid
.
Gets a global (g:) variable.
name | Variable name | |
[out] | err | Error details, if any |
Gets a v: variable.
name | Variable name | |
[out] | err | Error details, if any |
Queues raw user-input. Unlike |nvim_feedkeys()|, this uses a low-level input buffer and the call is non-blocking (input is processed asynchronously by the eventloop).
On execution error: does not fail, but updates v:errmsg.
keys | to be typed |
void nvim_input_mouse | ( | String | button, |
String | action, | ||
String | modifier, | ||
Integer | grid, | ||
Integer | row, | ||
Integer | col, | ||
Error * | err | ||
) |
Send mouse event from GUI.
Non-blocking: does not wait on any result, but queues the event to be processed soon by the event loop.
button | Mouse button: one of "left", "right", "middle", "wheel". | |
action | For ordinary buttons, one of "press", "drag", "release". For the wheel, one of "up", "down", "left", "right". | |
modifier | String of modifiers each represented by a single char. The same specifiers are used as for a key press, except that the "-" separator is optional, so "C-A-", "c-a" and "CA" can all be used to specify Ctrl+Alt+click. | |
grid | Grid number if the client uses |ui-multigrid|, else 0. | |
row | Mouse row-position (zero-based, like redraw events) | |
col | Mouse column-position (zero-based, like redraw events) | |
[out] | err | Error details, if any |
Get information about all open channels.
Gets a list of dictionaries representing attached UIs.
Object nvim_load_context | ( | Dictionary | dict | ) |
Sets the current editor state from the given |context| map.
dict | |Context| map. |
Object nvim_notify | ( | String | msg, |
Integer | log_level, | ||
Dictionary | opts, | ||
Error * | err | ||
) |
Notify the user with a message
Relays the call to vim.notify . By default forwards your message in the echo area but can be overridden to trigger desktop notifications.
msg | Message to display to the user | |
log_level | The log level | |
opts | Reserved for future use. | |
[out] | err | Error details, if any |
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 send on the channel will be echoed directly by the terminal. This is useful to display ANSI terminal sequences returned as part of a 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.
buffer | the buffer to use (expected to be empty) | |
opts | Optional parameters.
| |
[out] | err | Error details, if any |
Writes a message to the Vim output buffer. Does not append "\n", the message is buffered (won't display) until a linefeed is written.
str | Message |
Pastes at cursor, in any mode.
Invokes the vim.paste
handler, which handles each mode appropriately. Sets redo/undo. Faster than |nvim_input()|. Lines break at LF ("\n").
Errors ('nomodifiable', vim.paste()
failure, …) are reflected in err
but do not affect the return value (which is strictly decided by vim.paste()
). On error, subsequent calls are ignored ("drained") until the next paste is initiated (phase 1 or -1).
data | Multiline input. May be binary (containing NUL bytes). | |
crlf | Also break lines at CR and CRLF. | |
phase | -1: paste in a single call (i.e. without streaming). To "stream" a paste, call nvim_paste sequentially with these phase values:
| |
[out] | err | Error details, if any |
Puts text at cursor, in any mode.
Compare |:put| and |p| which are always linewise.
lines | |readfile()|-style list of lines. |channel-lines| | |
type | Edit behavior: any |getregtype()| result, or:
| |
after | If true insert after cursor (like |p|), or before (like |P|). | |
follow | If true place cursor at end of inserted text. | |
[out] | err | Error details, if any |
Replaces terminal codes and |keycodes| (<CR>, <Esc>, ...) in a string with the internal representation.
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. |
void nvim_select_popupmenu_item | ( | Integer | item, |
Boolean | insert, | ||
Boolean | finish, | ||
Dictionary | opts, | ||
Error * | err | ||
) |
Selects an item in the completion popupmenu.
If |ins-completion| is not active this API call is silently ignored. Useful for an external UI using |ui-popupmenu| to control the popupmenu with the mouse. Can also be used in a mapping; use <cmd> |:map-cmd| to ensure the mapping doesn't end completion mode.
item | Index (zero-based) of the item to select. Value of -1 selects nothing and restores the original text. | |
insert | Whether the selection should be inserted in the buffer. | |
finish | Finish the completion and dismiss the popupmenu. Implies insert . | |
opts | Optional parameters. Reserved for future use. | |
[out] | err | Error details, if any |
void nvim_set_client_info | ( | uint64_t | channel_id, |
String | name, | ||
Dictionary | version, | ||
String | type, | ||
Dictionary | methods, | ||
Dictionary | attributes, | ||
Error * | err | ||
) |
Self-identifies the client.
The client/plugin/application should call this after connecting, to provide hints about its identity and purpose, for debugging and orchestration.
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.
channel_id | ||
name | Short name for the connected client | |
version | Dictionary describing the version, with these (optional) keys:
| |
type | Must be one of the following values. Client libraries should default to "remote" unless overridden by the user.
| |
methods | Builtin methods in the client. For a host, this does not include plugin methods which will be discovered later. The key should be the method name, the values are dicts with these (optional) keys (more keys may be added in future versions of Nvim, thus unknown keys are ignored. Clients must only use keys defined in this or later versions of Nvim):
| |
attributes | Arbitrary string:string map of informal client properties. Suggested keys:
| |
[out] | err | Error details, if any |
Sets the current buffer.
buffer | Buffer handle | |
[out] | err | Error details, if any |
Sets the current line.
line | Line contents | |
[out] | err | Error details, if any |
Sets the current tabpage.
tabpage | Tabpage handle | |
[out] | err | Error details, if any |
Sets the current window.
window | Window handle | |
[out] | err | Error details, if any |
Sets a highlight group.
Note: Unlike the :highlight
command which can update a highlight group, this function completely replaces the definition. For example: nvim_set_hl(0, 'Visual', {})
will clear the highlight group 'Visual'.
ns_id | Namespace id for this highlight |nvim_create_namespace()|. Use 0 to set a highlight group globally |:highlight|. | |
name | Highlight group name, e.g. "ErrorMsg" | |
val | Highlight definition map, like |synIDattr()|. In addition, the following keys are recognized:
| |
[out] | err | Error details, if any |
void nvim_set_keymap | ( | uint64_t | channel_id, |
String | mode, | ||
String | lhs, | ||
String | rhs, | ||
Dict(keymap) * | opts, | ||
Error * | err | ||
) |
Sets a global |mapping| for the given mode.
To set a buffer-local mapping, use |nvim_buf_set_keymap()|.
Unlike |:map|, leading/trailing whitespace is accepted as part of the {lhs} or {rhs}. Empty {rhs} is |<Nop>|. |keycodes| are replaced as usual.
Example:
call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
is equivalent to:
nmap <nowait> <Space><NL> <Nop>
channel_id | ||
mode | Mode short-name (map command prefix: "n", "i", "v", "x", …) or "!" for |:map!|, or empty string for |:map|. | |
lhs | Left-hand-side |{lhs}| of the mapping. | |
rhs | Right-hand-side |{rhs}| of the mapping. | |
opts | Optional parameters map. Accepts all |:map-arguments| as keys excluding |<buffer>| but including |noremap| and "desc". "desc" can be used to give a description to keymap. When called from Lua, also accepts a "callback" key that takes a Lua function to call when the mapping is executed. Values are Booleans. Unknown key is an error. | |
[out] | err | Error details, if any. |
Sets the global value of an option.
channel_id | ||
name | Option name | |
value | New option value | |
[out] | err | Error details, if any |
Sets the value of an option. The behavior of this function matches that of |:set|: for global-local options, both the global and local value are set unless otherwise specified with {scope}.
name | Option name | |
value | New option value | |
opts | Optional parameters
| |
[out] | err | Error details, if any |
Sets a global (g:) variable.
name | Variable name | |
value | Variable value | |
[out] | err | Error details, if any |
Sets a v: variable, if it is not readonly.
name | Variable name | |
value | Variable value | |
[out] | err | Error details, if any |
Calculates the number of display cells occupied by text
. <Tab> counts as one cell.
text | Some text | |
[out] | err | Error details, if any |
Subscribes to event broadcasts.
channel_id | Channel id (passed automatically by the dispatcher) |
event | Event type string |