neovim/neovim
Public API surface
A taxonomy of the nvim_* API. The full reference is in runtime/doc/api.txt; this page is the orientation map.
Buffers
src/nvim/api/buffer.c plus src/nvim/api/extmark.c.
| Function | Purpose |
|---|---|
nvim_buf_get_lines(buf, start, end, strict) |
Read a range of lines. |
nvim_buf_set_lines(buf, start, end, strict, replacement) |
Replace a range. |
nvim_buf_get_text, nvim_buf_set_text |
Byte-level get/set; useful for partial-line edits. |
nvim_buf_attach, nvim_buf_detach |
Subscribe to text changes. |
nvim_buf_line_count |
Line count. |
nvim_buf_get_name, nvim_buf_set_name |
File name. |
nvim_buf_get_var, nvim_buf_set_var, nvim_buf_del_var |
Buffer-scoped variables (b:). |
nvim_buf_get_mark, nvim_buf_set_mark, nvim_buf_del_mark |
Named marks. |
nvim_buf_get_option, nvim_buf_set_option (deprecated) |
Per-buffer options — superseded by nvim_get_option_value with {buf=}. |
nvim_buf_set_keymap, nvim_buf_del_keymap |
Buffer-local keymaps. |
nvim_buf_create_user_command, nvim_buf_del_user_command |
Buffer-local Ex commands. |
nvim_buf_get_changedtick |
Monotonic change counter. |
Extmarks (src/nvim/api/extmark.c):
| Function | Purpose |
|---|---|
nvim_create_namespace(name) |
Get a namespace handle. |
nvim_buf_set_extmark, nvim_buf_del_extmark, nvim_buf_get_extmark_by_id, nvim_buf_get_extmarks |
Extmark CRUD. |
nvim_buf_clear_namespace |
Clear all extmarks/highlights in a namespace within a range. |
Windows
src/nvim/api/window.c plus src/nvim/api/win_config.c.
| Function | Purpose |
|---|---|
nvim_get_current_win, nvim_set_current_win |
Active window. |
nvim_win_get_buf, nvim_win_set_buf |
Switch the buffer in a window. |
nvim_win_get_cursor, nvim_win_set_cursor |
Cursor position. |
nvim_win_get_height, nvim_win_set_height, nvim_win_get_width, nvim_win_set_width |
Resize. |
nvim_win_close, nvim_win_hide |
Close / hide. |
nvim_open_win(buf, enter, config) |
Floating windows. Most-used function in win_config.c. |
nvim_win_set_config, nvim_win_get_config |
Float config CRUD. |
nvim_win_text_height |
Compute pixel/line height of a range. |
Tab pages
src/nvim/api/tabpage.c.
| Function | Purpose |
|---|---|
nvim_get_current_tabpage, nvim_set_current_tabpage |
Active tab. |
nvim_tabpage_list_wins |
Windows in tab. |
nvim_tabpage_get_var, nvim_tabpage_set_var |
Tab-scoped variables. |
Editor commands and Vimscript
src/nvim/api/vim.c plus src/nvim/api/vimscript.c.
| Function | Purpose |
|---|---|
nvim_command(cmd), nvim_exec2(src, opts) |
Run an Ex command (or block). |
nvim_eval(expr), nvim_call_function(fn, args), nvim_call_dict_function(dict, fn, args) |
Vimscript expression / function. |
nvim_input(keys), nvim_input_mouse(...) |
Send input. |
nvim_replace_termcodes(str, from_part, do_lt, special) |
Encode <esc>-style strings. |
nvim_feedkeys(keys, mode, escape_ks) |
Like :execute "normal! " from Lua. |
nvim_paste(data, crlf, phase) |
Paste a chunk. Used by clipboard integration. |
nvim_put(lines, type, after, follow) |
Insert lines like :put. |
nvim_strwidth(text) |
Display width of a string. |
Autocmds
src/nvim/api/autocmd.c. See Autocmds.
| Function | Purpose |
|---|---|
nvim_create_autocmd(event, opts) |
Register. |
nvim_clear_autocmds(opts) |
Delete by filter. |
nvim_create_augroup(name, opts) |
Create an autocmd group. |
nvim_get_autocmds(opts) |
Inspect. |
nvim_exec_autocmds(event, opts) |
Manually fire. |
User commands
src/nvim/api/command.c.
| Function | Purpose |
|---|---|
nvim_create_user_command(name, fn, opts) |
Register a global Ex command. |
nvim_buf_create_user_command(...) |
Buffer-local. |
nvim_del_user_command, nvim_buf_del_user_command |
Delete. |
nvim_get_commands(opts) |
Inspect. |
nvim_parse_cmd(str), nvim_cmd(cmd, opts) |
Parse a command line / run a parsed command. |
Options
src/nvim/api/options.c. See Options.
| Function | Purpose |
|---|---|
nvim_get_option_value(name, opts) |
Read scoped option. |
nvim_set_option_value(name, value, opts) |
Write scoped option. |
nvim_get_option_info(name) |
Metadata. |
nvim_get_all_options_info() |
All options. |
Highlights and namespaces
src/nvim/api/vim.c plus src/nvim/api/extmark.c.
| Function | Purpose |
|---|---|
nvim_set_hl(ns_id, name, val) |
Set a highlight in a namespace. |
nvim_get_hl(ns_id, opts) |
Read. |
nvim_set_hl_ns(ns_id) |
Activate a namespace's highlights. |
nvim_set_decoration_provider(ns_id, opts) |
Register a decoration provider. |
UI
src/nvim/api/ui.c. See UI events.
| Function | Purpose |
|---|---|
nvim_ui_attach(width, height, opts) |
Attach as a UI. |
nvim_ui_detach() |
Detach. |
nvim_ui_try_resize, nvim_ui_set_option |
Reconfigure. |
nvim_ui_pum_set_height etc. |
Specific extension config. |
nvim_ui_term_event(event, value) |
Terminal-style events forwarded by the TUI. |
Channels
src/nvim/msgpack_rpc/server.c + bits in vim.c.
| Function | Purpose |
|---|---|
nvim_chan_send(chan, data) |
Write to a channel. |
nvim_get_chan_info(chan), nvim_list_chans() |
Inspect. |
nvim_get_proc_children(pid), nvim_get_proc(pid) |
Process info. |
Miscellaneous
| Function | Purpose |
| ------------------------------------------------------ | ------------------------------------------------ | --------- |
| nvim_get_api_info() | The api-level metadata (UIs use this on attach). |
| nvim_get_runtime_file, nvim_list_runtime_paths | Runtime files. |
| nvim_get_color_by_name, nvim_get_color_map | Color helpers. |
| nvim_get_current_line, nvim_set_current_line | Convenience. |
| nvim_err_write, nvim_err_writeln, nvim_out_write | Output. |
| nvim_echo(chunks, history, opts) | Like :echohl … | echom …. |
| nvim_subscribe, nvim_unsubscribe | Notification routing for embedded clients. |
| nvim_load_context, nvim_get_context | Capture/restore editor state for tests. |
Where to read more
- Per-area details are in the docstrings above each function in
src/nvim/api/*.c. - The user manual is
runtime/doc/api.txt. Run:help api-...to jump to a specific function. - Examples are scattered through
test/functional/api/. Each function has at least one functional test.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.