2017-03-21 09:08:19 -07:00
|
|
|
*api.txt* Nvim
|
2016-02-07 05:05:59 -07:00
|
|
|
|
|
|
|
|
|
|
|
NVIM REFERENCE MANUAL by Thiago de Arruda
|
|
|
|
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
Nvim API *API* *api*
|
2016-06-14 20:12:43 -07:00
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
Nvim exposes a powerful API that can be used by plugins and external processes
|
2017-08-19 05:13:14 -07:00
|
|
|
via |RPC|, |Lua| and VimL (|eval-api|).
|
2016-02-07 05:05:59 -07:00
|
|
|
|
2017-04-17 14:52:38 -07:00
|
|
|
Applications can also embed libnvim to work with the C API directly.
|
2016-02-07 05:05:59 -07:00
|
|
|
|
2017-10-20 17:33:58 -07:00
|
|
|
Type |gO| to see the table of contents.
|
2017-05-01 08:09:29 -07:00
|
|
|
|
2016-02-07 05:05:59 -07:00
|
|
|
==============================================================================
|
2017-03-01 09:18:03 -07:00
|
|
|
API Types *api-types*
|
2016-02-07 05:05:59 -07:00
|
|
|
|
2017-12-27 11:30:23 -07:00
|
|
|
The Nvim C API defines custom types for all function parameters. Some are just
|
|
|
|
typedefs around C99 standard types, others are Nvim-defined data structures.
|
2016-02-07 05:05:59 -07:00
|
|
|
|
2017-12-27 11:30:23 -07:00
|
|
|
Boolean -> bool
|
|
|
|
Integer (signed 64-bit integer) -> int64_t
|
|
|
|
Float (IEEE 754 double precision) -> double
|
|
|
|
String -> {char* data, size_t size} struct
|
|
|
|
Array
|
|
|
|
Dictionary
|
|
|
|
Object
|
2016-02-07 05:05:59 -07:00
|
|
|
|
|
|
|
The following handle types are defined as integer typedefs, but are
|
|
|
|
discriminated as separate types in an Object:
|
|
|
|
|
2017-12-27 11:30:23 -07:00
|
|
|
Buffer -> enum value kObjectTypeBuffer
|
|
|
|
Window -> enum value kObjectTypeWindow
|
|
|
|
Tabpage -> enum value kObjectTypeTabpage
|
2016-02-07 05:05:59 -07:00
|
|
|
|
|
|
|
==============================================================================
|
2017-03-01 09:18:03 -07:00
|
|
|
API metadata *api-metadata*
|
2016-02-07 05:05:59 -07:00
|
|
|
|
2016-10-31 08:16:37 -07:00
|
|
|
Nvim exposes API metadata as a Dictionary. Some items are described below:
|
|
|
|
|
|
|
|
version Nvim version, API level/compatibility
|
2019-01-27 07:06:11 -07:00
|
|
|
version.api_level API version integer *api-level*
|
2016-10-31 08:16:37 -07:00
|
|
|
version.api_compatible API is backwards-compatible with this level
|
2019-01-27 07:06:11 -07:00
|
|
|
version.api_prerelease Declares the API as unstable/unreleased >
|
2016-10-31 08:16:37 -07:00
|
|
|
(version.api_prerelease && fn.since == version.api_level)
|
|
|
|
functions API function signatures
|
2017-09-10 01:01:18 -07:00
|
|
|
ui_events UI event signatures |ui|
|
2018-02-13 05:45:49 -07:00
|
|
|
ui_options Supported |ui-options|
|
2016-10-31 08:16:37 -07:00
|
|
|
{fn}.since API level where function {fn} was introduced
|
|
|
|
{fn}.deprecated_since API level where function {fn} was deprecated
|
|
|
|
types Custom handle types defined by Nvim
|
|
|
|
error_types Possible error types returned by API functions
|
|
|
|
|
|
|
|
External programs ("clients") can use the metadata to discover the |rpc-api|.
|
2016-02-07 05:05:59 -07:00
|
|
|
|
2017-04-17 14:52:38 -07:00
|
|
|
==============================================================================
|
|
|
|
API contract *api-contract*
|
|
|
|
|
2017-12-27 11:30:23 -07:00
|
|
|
The Nvim API is composed of functions and events.
|
|
|
|
|
|
|
|
- Clients call functions like those described at |api-global|.
|
|
|
|
- Clients can subscribe to |ui-events|, |api-buffer-updates|, etc.
|
|
|
|
- API function names are prefixed with "nvim_".
|
|
|
|
- API event names are prefixed with "nvim_" and suffixed with "_event".
|
2017-04-17 14:52:38 -07:00
|
|
|
|
2017-12-27 11:30:23 -07:00
|
|
|
As Nvim evolves the API may change in compliance with this CONTRACT:
|
2017-04-17 14:52:38 -07:00
|
|
|
|
|
|
|
- New functions and events may be added.
|
|
|
|
- Any such extensions are OPTIONAL: old clients may ignore them.
|
|
|
|
- Function signatures will NOT CHANGE (after release).
|
|
|
|
- Functions introduced in the development (unreleased) version MAY CHANGE.
|
|
|
|
(Clients can dynamically check `api_prerelease`, etc. |api-metadata|)
|
|
|
|
- Event parameters will not be removed or reordered (after release).
|
|
|
|
- Events may be EXTENDED: new parameters may be added.
|
|
|
|
- New items may be ADDED to map/list parameters/results of functions and
|
|
|
|
events.
|
|
|
|
- Any such new items are OPTIONAL: old clients may ignore them.
|
|
|
|
- Existing items will not be removed (after release).
|
|
|
|
- Deprecated functions will not be removed until Nvim version 2.0
|
|
|
|
|
2018-12-01 08:44:36 -07:00
|
|
|
==============================================================================
|
|
|
|
Global events *api-global-events*
|
|
|
|
|
|
|
|
When a client invokes an API request as an async notification, it is not
|
|
|
|
possible for Nvim to send an error response. Instead, in case of error, the
|
|
|
|
following notification will be sent to the client:
|
|
|
|
|
|
|
|
*nvim_error_event*
|
|
|
|
nvim_error_event[{type}, {message}]
|
|
|
|
|
|
|
|
{type} is a numeric id as defined by `api_info().error_types`, and {message} is
|
|
|
|
a string with the error message.
|
|
|
|
|
2016-02-07 05:05:59 -07:00
|
|
|
==============================================================================
|
2018-06-08 01:19:46 -07:00
|
|
|
Buffer update events *api-buffer-updates*
|
|
|
|
|
|
|
|
API clients can "attach" to Nvim buffers to subscribe to buffer update events.
|
|
|
|
This is similar to |TextChanged| but more powerful and granular.
|
|
|
|
|
2018-08-25 07:38:24 -07:00
|
|
|
Call |nvim_buf_attach()| to receive these events on the channel:
|
2018-06-08 01:19:46 -07:00
|
|
|
|
|
|
|
*nvim_buf_lines_event*
|
|
|
|
nvim_buf_lines_event[{buf}, {changedtick}, {firstline}, {lastline}, {linedata}, {more}]
|
|
|
|
|
|
|
|
When the buffer text between {firstline} and {lastline} (end-exclusive,
|
|
|
|
zero-indexed) were changed to the new text in the {linedata} list. The
|
|
|
|
granularity is a line, i.e. if a single character is changed in the editor,
|
|
|
|
the entire line is sent.
|
|
|
|
|
|
|
|
When {changedtick} is |v:null| this means the screen lines (display) changed
|
|
|
|
but not the buffer contents. {linedata} contains the changed screen lines.
|
2018-11-04 18:47:22 -07:00
|
|
|
This happens when 'inccommand' shows a buffer preview.
|
2018-06-08 01:19:46 -07:00
|
|
|
|
|
|
|
Properties:~
|
|
|
|
{buf} API buffer handle (buffer number)
|
|
|
|
|
|
|
|
{changedtick} value of |b:changedtick| for the buffer. If you send an API
|
|
|
|
command back to nvim you can check the value of |b:changedtick| as part of
|
|
|
|
your request to ensure that no other changes have been made.
|
|
|
|
|
|
|
|
{firstline} integer line number of the first line that was replaced.
|
|
|
|
Zero-indexed: if line 1 was replaced then {firstline} will be 0, not 1.
|
|
|
|
{firstline} is always less than or equal to the number of lines that were
|
|
|
|
in the buffer before the lines were replaced.
|
|
|
|
|
|
|
|
{lastline} integer line number of the first line that was not replaced
|
|
|
|
(i.e. the range {firstline}, {lastline} is end-exclusive).
|
|
|
|
Zero-indexed: if line numbers 2 to 5 were replaced, this will be 5 instead
|
|
|
|
of 6. {lastline} is always be less than or equal to the number of lines
|
|
|
|
that were in the buffer before the lines were replaced. {lastline} will be
|
|
|
|
-1 if the event is part of the initial update after attaching.
|
|
|
|
|
|
|
|
{linedata} list of strings containing the contents of the new buffer
|
|
|
|
lines. Newline characters are omitted; empty lines are sent as empty
|
|
|
|
strings.
|
|
|
|
|
|
|
|
{more} boolean, true for a "multipart" change notification: the current
|
|
|
|
change was chunked into multiple |nvim_buf_lines_event| notifications
|
|
|
|
(e.g. because it was too big).
|
|
|
|
|
|
|
|
nvim_buf_changedtick_event[{buf}, {changedtick}] *nvim_buf_changedtick_event*
|
|
|
|
|
|
|
|
When |b:changedtick| was incremented but no text was changed. Relevant for
|
|
|
|
undo/redo.
|
|
|
|
|
|
|
|
Properties:~
|
|
|
|
{buf} API buffer handle (buffer number)
|
|
|
|
{changedtick} new value of |b:changedtick| for the buffer
|
|
|
|
|
|
|
|
nvim_buf_detach_event[{buf}] *nvim_buf_detach_event*
|
|
|
|
|
|
|
|
When buffer is detached (i.e. updates are disabled). Triggered explicitly by
|
2018-11-04 18:47:22 -07:00
|
|
|
|nvim_buf_detach()| or implicitly in these cases:
|
2018-06-08 01:19:46 -07:00
|
|
|
- Buffer was |abandon|ed and 'hidden' is not set.
|
|
|
|
- Buffer was reloaded, e.g. with |:edit| or an external change triggered
|
|
|
|
|:checktime| or 'autoread'.
|
|
|
|
- Generally: whenever the buffer contents are unloaded from memory.
|
|
|
|
|
|
|
|
Properties:~
|
|
|
|
{buf} API buffer handle (buffer number)
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLE ~
|
|
|
|
|
2018-08-25 07:38:24 -07:00
|
|
|
Calling |nvim_buf_attach()| with send_buffer=true on an empty buffer, emits: >
|
2019-01-21 20:43:44 -07:00
|
|
|
nvim_buf_lines_event[{buf}, {changedtick}, 0, -1, [""], v:false]
|
2018-06-08 01:19:46 -07:00
|
|
|
|
|
|
|
User adds two lines to the buffer, emits: >
|
|
|
|
nvim_buf_lines_event[{buf}, {changedtick}, 0, 0, ["line1", "line2"], v:false]
|
|
|
|
|
|
|
|
User moves to a line containing the text "Hello world" and inserts "!", emits: >
|
|
|
|
nvim_buf_lines_event[{buf}, {changedtick}, {linenr}, {linenr} + 1,
|
|
|
|
["Hello world!"], v:false]
|
|
|
|
|
|
|
|
User moves to line 3 and deletes 20 lines using "20dd", emits: >
|
|
|
|
nvim_buf_lines_event[{buf}, {changedtick}, 2, 22, [], v:false]
|
|
|
|
|
|
|
|
User selects lines 3-5 using |linewise-visual| mode and then types "p" to
|
|
|
|
paste a block of 6 lines, emits: >
|
|
|
|
nvim_buf_lines_event[{buf}, {changedtick}, 2, 5,
|
|
|
|
['pasted line 1', 'pasted line 2', 'pasted line 3', 'pasted line 4',
|
|
|
|
'pasted line 5', 'pasted line 6'],
|
|
|
|
v:false
|
|
|
|
]
|
|
|
|
|
|
|
|
User reloads the buffer with ":edit", emits: >
|
|
|
|
nvim_buf_detach_event[{buf}]
|
|
|
|
|
|
|
|
==============================================================================
|
2017-03-01 09:18:03 -07:00
|
|
|
Buffer highlighting *api-highlights*
|
2016-02-07 05:05:59 -07:00
|
|
|
|
|
|
|
Nvim allows plugins to add position-based highlights to buffers. This is
|
|
|
|
similar to |matchaddpos()| but with some key differences. The added highlights
|
|
|
|
are associated with a buffer and adapts to line insertions and deletions,
|
|
|
|
similar to signs. It is also possible to manage a set of highlights as a group
|
|
|
|
and delete or replace all at once.
|
|
|
|
|
|
|
|
The intended use case are linter or semantic highlighter plugins that monitor
|
|
|
|
a buffer for changes, and in the background compute highlights to the buffer.
|
|
|
|
Another use case are plugins that show output in an append-only buffer, and
|
|
|
|
want to add highlights to the outputs. Highlight data cannot be preserved
|
|
|
|
on writing and loading a buffer to file, nor in undo/redo cycles.
|
|
|
|
|
2018-08-25 07:38:24 -07:00
|
|
|
Highlights are registered using the |nvim_buf_add_highlight()| function. If an
|
|
|
|
external highlighter plugin wants to add many highlights in a batch,
|
|
|
|
performance can be improved by calling |nvim_buf_add_highlight()| as an
|
|
|
|
asynchronous notification, after first (synchronously) reqesting a source id.
|
2019-04-08 14:08:01 -07:00
|
|
|
|
|
|
|
Example using the Python API client (|pynvim|):
|
2016-02-07 05:05:59 -07:00
|
|
|
>
|
|
|
|
src = vim.new_highlight_source()
|
|
|
|
buf = vim.current.buffer
|
|
|
|
for i in range(5):
|
|
|
|
buf.add_highlight("String",i,0,-1,src_id=src)
|
2019-04-08 14:08:01 -07:00
|
|
|
# some time later ...
|
|
|
|
buf.clear_namespace(src)
|
2016-02-07 05:05:59 -07:00
|
|
|
<
|
|
|
|
If the highlights don't need to be deleted or updated, just pass -1 as
|
2018-12-01 08:44:36 -07:00
|
|
|
src_id (this is the default in python). Use |nvim_buf_clear_namespace()| to
|
2018-08-25 07:38:24 -07:00
|
|
|
clear highlights from a specific source, in a specific line range or the
|
|
|
|
entire buffer by passing in the line range 0, -1 (the latter is the default in
|
|
|
|
python as used above).
|
2016-02-07 05:05:59 -07:00
|
|
|
|
2019-04-08 14:08:01 -07:00
|
|
|
Example using the API from Vimscript: >
|
2016-06-28 12:45:19 -07:00
|
|
|
|
|
|
|
call nvim_buf_set_lines(0, 0, 0, v:true, ["test text"])
|
|
|
|
let src = nvim_buf_add_highlight(0, 0, "String", 1, 0, 4)
|
|
|
|
call nvim_buf_add_highlight(0, src, "Identifier", 0, 5, -1)
|
2019-04-08 14:08:01 -07:00
|
|
|
" some time later ...
|
2018-12-01 08:44:36 -07:00
|
|
|
call nvim_buf_clear_namespace(0, src, 0, -1)
|
2019-03-03 04:38:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
Floating windows *api-floatwin*
|
|
|
|
|
|
|
|
Nvim supports floating windows, windows that are displayed on top of ordinary
|
|
|
|
windows. This is useful to implement simple widgets, such as tooltips
|
|
|
|
displaying information next to cursor text. Floating windows are fully
|
|
|
|
functional buffer windows and support user editing. They support the standard
|
|
|
|
|api-window| calls and almost all window options (with some exceptions such as
|
|
|
|
'statusline' is not supported currently).
|
|
|
|
|
|
|
|
Floating windows are created either by |nvim_open_win()| to open a new window,
|
2019-03-15 10:18:56 -07:00
|
|
|
or |nvim_win_set_config()| to reconfigure a normal window into a float.
|
2019-03-20 04:44:06 -07:00
|
|
|
Currently the position can either be grid coordinates relative to the top-left
|
|
|
|
of some window, or a position relative to the current window cursor. The
|
2019-03-15 10:18:56 -07:00
|
|
|
parameters for positioning are described in detail at |nvim_open_win()|.
|
2019-03-03 04:38:14 -07:00
|
|
|
|
|
|
|
|nvim_open_win()| assumes an existing buffer to display in the window. To create
|
2019-03-27 03:11:52 -07:00
|
|
|
a scratch buffer for the float, |nvim_create_buf()| can be used. The text in
|
2019-03-03 04:38:14 -07:00
|
|
|
the buffer can be highlighted using standard functionality, such as syntax
|
|
|
|
highlighting, or |api-highlights|.
|
|
|
|
|
|
|
|
By default, floats will use |hl-NormalFloat| as normal highlight, which
|
|
|
|
links to |hl-Pmenu| in the builtin color scheme. The 'winhighlight' option can
|
|
|
|
be used to override it. Currently, floating windows don't support any visual
|
|
|
|
decorations like a border or additional widgets like scrollbar.
|
|
|
|
|
|
|
|
Here is an example for creating a float with scratch buffer: >
|
|
|
|
|
|
|
|
let buf = nvim_create_buf(v:false, v:true)
|
|
|
|
call nvim_buf_set_lines(buf, 0, -1, v:true, ["test", "text"])
|
2019-03-15 10:18:56 -07:00
|
|
|
let opts = {'relative': 'cursor', 'width': 10, 'height': 2, 'col': 0,
|
|
|
|
\ 'row': 1, 'anchor': 'NW'}
|
|
|
|
let win = nvim_open_win(buf, 0, opts)
|
2019-03-03 04:38:14 -07:00
|
|
|
" optional: change highlight, otherwise Pmenu is used
|
|
|
|
call nvim_win_set_option(win, 'winhl', 'Normal:MyHighlight')
|
2016-06-28 12:45:19 -07:00
|
|
|
>
|
2019-03-03 04:38:14 -07:00
|
|
|
To close the float, |nvim_win_close()| can be used.
|
2016-02-07 05:05:59 -07:00
|
|
|
==============================================================================
|
2017-03-01 09:18:03 -07:00
|
|
|
Global Functions *api-global*
|
|
|
|
|
|
|
|
nvim_command({command}) *nvim_command()*
|
2018-06-10 15:20:39 -07:00
|
|
|
Executes an ex-command.
|
|
|
|
|
|
|
|
On execution error: fails with VimL error, does not update
|
|
|
|
v:errmsg.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{command} Ex-command string
|
|
|
|
|
2017-11-05 18:00:39 -07:00
|
|
|
nvim_get_hl_by_name({name}, {rgb}) *nvim_get_hl_by_name()*
|
|
|
|
Gets a highlight definition by name.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{name} Highlight group name
|
|
|
|
{rgb} Export RGB colors
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
Highlight definition map
|
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
See also: ~
|
|
|
|
nvim_get_hl_by_id
|
|
|
|
|
2017-11-05 18:00:39 -07:00
|
|
|
nvim_get_hl_by_id({hl_id}, {rgb}) *nvim_get_hl_by_id()*
|
|
|
|
Gets a highlight definition by id. |hlID()|
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{hl_id} Highlight id as returned by |hlID()|
|
|
|
|
{rgb} Export RGB colors
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
Highlight definition map
|
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
See also: ~
|
|
|
|
nvim_get_hl_by_name
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
|
2018-06-10 15:20:39 -07:00
|
|
|
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.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{keys} to be typed
|
2018-06-10 15:20:39 -07:00
|
|
|
{mode} behavior flags, see |feedkeys()|
|
2017-03-01 09:18:03 -07:00
|
|
|
{escape_csi} If true, escape K_SPECIAL/CSI bytes in
|
|
|
|
`keys`
|
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
See also: ~
|
|
|
|
feedkeys()
|
|
|
|
vim_strsave_escape_csi
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_input({keys}) *nvim_input()*
|
2018-06-10 15:20:39 -07:00
|
|
|
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).
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
On execution error: does not fail, but updates v:errmsg.
|
2017-11-05 18:00:39 -07:00
|
|
|
|
|
|
|
Note:
|
|
|
|
|keycodes| like <CR> are translated, so "<" is special. To
|
|
|
|
input a literal "<", send <LT>.
|
2019-01-10 17:20:15 -07:00
|
|
|
Note:
|
|
|
|
For mouse events use |nvim_input_mouse()|. The pseudokey
|
2019-01-26 12:10:59 -07:00
|
|
|
form "<LeftMouse><col,row>" is deprecated since
|
|
|
|
|api-level| 6.
|
2019-01-10 17:20:15 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Attributes: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{async}
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{keys} to be typed
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Number of bytes actually written (can be fewer than
|
|
|
|
requested if the buffer becomes full).
|
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
*nvim_input_mouse()*
|
|
|
|
nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
|
|
|
|
Send mouse event from GUI.
|
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
Non-blocking: does not wait on any result, but queues the
|
|
|
|
event to be processed soon by the event loop.
|
2019-01-10 17:20:15 -07:00
|
|
|
|
|
|
|
Note:
|
|
|
|
Currently this doesn't support "scripting" multiple mouse
|
|
|
|
events by calling it multiple times in a loop: the
|
|
|
|
intermediate mouse positions will be ignored. It should be
|
|
|
|
used to implement real-time mouse input in a GUI. The
|
|
|
|
deprecated pseudokey form ("<LeftMouse><col,row>") of
|
|
|
|
|nvim_input()| has the same limitiation.
|
|
|
|
|
|
|
|
Attributes: ~
|
|
|
|
{async}
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{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)
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
*nvim_replace_termcodes()*
|
|
|
|
nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
|
2017-07-02 04:46:41 -07:00
|
|
|
Replaces terminal codes and |keycodes| (<CR>, <Esc>, ...) in a
|
|
|
|
string with the internal representation.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
{str} String to be converted.
|
|
|
|
{from_part} Legacy Vim parameter. Usually true.
|
2017-08-17 14:30:28 -07:00
|
|
|
{do_lt} Also translate <lt>. Ignored if `special` is
|
|
|
|
false.
|
2017-07-02 04:46:41 -07:00
|
|
|
{special} Replace |keycodes|, e.g. <CR> becomes a "\n"
|
|
|
|
char.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
See also: ~
|
|
|
|
replace_termcodes
|
|
|
|
cpoptions
|
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
nvim_command_output({command}) *nvim_command_output()*
|
|
|
|
Executes an ex-command and returns its (non-error) output.
|
|
|
|
Shell |:!| output is not captured.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
On execution error: fails with VimL error, does not update
|
|
|
|
v:errmsg.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
{command} Ex-command string
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
nvim_eval({expr}) *nvim_eval()*
|
|
|
|
Evaluates a VimL expression (:help expression). Dictionaries
|
|
|
|
and Lists are recursively expanded.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
On execution error: fails with VimL error, does not update
|
|
|
|
v:errmsg.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
{expr} VimL expression string
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Evaluation result or expanded object
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2017-07-02 04:46:41 -07:00
|
|
|
nvim_execute_lua({code}, {args}) *nvim_execute_lua()*
|
2017-11-05 18:00:39 -07:00
|
|
|
Execute lua code. Parameters (if any) are available as `...`
|
|
|
|
inside the chunk. The chunk can return a value.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2017-11-05 18:00:39 -07:00
|
|
|
Only statements are executed. To evaluate an expression,
|
2019-03-03 07:01:16 -07:00
|
|
|
prefix it with `return` : return my_function(...)
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
{code} lua code to execute
|
|
|
|
{args} Arguments to the code
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
Return value of lua code if present or NIL.
|
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
nvim_call_function({fn}, {args}) *nvim_call_function()*
|
|
|
|
Calls a VimL function with the given arguments.
|
|
|
|
|
|
|
|
On execution error: fails with VimL error, does not update
|
|
|
|
v:errmsg.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
{fn} Function to call
|
|
|
|
{args} Function arguments packed in an Array
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Result of the function call
|
|
|
|
|
|
|
|
nvim_call_dict_function({dict}, {fn}, {args}) *nvim_call_dict_function()*
|
|
|
|
Calls a VimL |Dictionary-function| with the given arguments.
|
|
|
|
|
|
|
|
On execution error: fails with VimL error, does not update
|
|
|
|
v:errmsg.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
{dict} Dictionary, or String evaluating to a VimL |self|
|
|
|
|
dict
|
|
|
|
{fn} Name of the function defined on the VimL dict
|
|
|
|
{args} Function arguments packed in an Array
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Result of the function call
|
|
|
|
|
2017-11-05 18:00:39 -07:00
|
|
|
nvim_strwidth({text}) *nvim_strwidth()*
|
2019-03-03 07:01:16 -07:00
|
|
|
Calculates the number of display cells occupied by `text` .
|
2017-03-01 09:18:03 -07:00
|
|
|
<Tab> counts as one cell.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{text} Some text
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Number of cells
|
|
|
|
|
|
|
|
nvim_list_runtime_paths() *nvim_list_runtime_paths()*
|
|
|
|
Gets the paths contained in 'runtimepath'.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
List of paths
|
|
|
|
|
|
|
|
nvim_set_current_dir({dir}) *nvim_set_current_dir()*
|
|
|
|
Changes the global working directory.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{dir} Directory path
|
|
|
|
|
|
|
|
nvim_get_current_line() *nvim_get_current_line()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets the current line.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Current line string
|
|
|
|
|
|
|
|
nvim_set_current_line({line}) *nvim_set_current_line()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Sets the current line.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{line} Line contents
|
|
|
|
|
|
|
|
nvim_del_current_line() *nvim_del_current_line()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Deletes the current line.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
nvim_get_var({name}) *nvim_get_var()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets a global (g:) variable.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Variable name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Variable value
|
|
|
|
|
|
|
|
nvim_set_var({name}, {value}) *nvim_set_var()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Sets a global (g:) variable.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Variable name
|
|
|
|
{value} Variable value
|
|
|
|
|
|
|
|
nvim_del_var({name}) *nvim_del_var()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Removes a global (g:) variable.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Variable name
|
|
|
|
|
|
|
|
nvim_get_vvar({name}) *nvim_get_vvar()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets a v: variable.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Variable name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Variable value
|
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
nvim_set_vvar({name}, {value}) *nvim_set_vvar()*
|
|
|
|
Sets a v: variable, if it is not readonly.
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{name} Variable name
|
|
|
|
{value} Variable value
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_get_option({name}) *nvim_get_option()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets an option value string.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Option name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-05-01 09:52:56 -07:00
|
|
|
Option value (global)
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
nvim_set_option({name}, {value}) *nvim_set_option()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Sets an option value.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Option name
|
|
|
|
{value} New option value
|
|
|
|
|
|
|
|
nvim_out_write({str}) *nvim_out_write()*
|
2017-08-17 14:30:28 -07:00
|
|
|
Writes a message to the Vim output buffer. Does not append
|
|
|
|
"\n", the message is buffered (won't display) until a linefeed
|
|
|
|
is written.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{str} Message
|
|
|
|
|
|
|
|
nvim_err_write({str}) *nvim_err_write()*
|
2017-08-17 14:30:28 -07:00
|
|
|
Writes a message to the Vim error buffer. Does not append
|
|
|
|
"\n", the message is buffered (won't display) until a linefeed
|
|
|
|
is written.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{str} Message
|
|
|
|
|
|
|
|
nvim_err_writeln({str}) *nvim_err_writeln()*
|
2017-08-17 14:30:28 -07:00
|
|
|
Writes a message to the Vim error buffer. Appends "\n", so the
|
|
|
|
buffer is flushed (and displayed).
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{str} Message
|
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
See also: ~
|
|
|
|
nvim_err_write()
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_list_bufs() *nvim_list_bufs()*
|
|
|
|
Gets the current list of buffer handles
|
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
Includes unlisted (unloaded/deleted) buffers, like `:ls!` .
|
|
|
|
Use |nvim_buf_is_loaded()| to check if a buffer is loaded.
|
2018-11-15 18:00:04 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
List of buffer handles
|
|
|
|
|
|
|
|
nvim_get_current_buf() *nvim_get_current_buf()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets the current buffer.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Buffer handle
|
|
|
|
|
|
|
|
nvim_set_current_buf({buffer}) *nvim_set_current_buf()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Sets the current buffer.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{buffer} Buffer handle
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
nvim_list_wins() *nvim_list_wins()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets the current list of window handles.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
List of window handles
|
|
|
|
|
|
|
|
nvim_get_current_win() *nvim_get_current_win()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets the current window.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Window handle
|
|
|
|
|
|
|
|
nvim_set_current_win({window}) *nvim_set_current_win()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Sets the current window.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{window} Window handle
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2019-03-12 05:46:02 -07:00
|
|
|
nvim_create_buf({listed}, {scratch}) *nvim_create_buf()*
|
|
|
|
Creates a new, empty, unnamed buffer.
|
|
|
|
|
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{listed} Sets 'buflisted'
|
2019-03-12 05:46:02 -07:00
|
|
|
{scratch} Creates a "throwaway" |scratch-buffer| for
|
|
|
|
temporary work (always 'nomodified')
|
|
|
|
|
|
|
|
Return: ~
|
|
|
|
Buffer handle, or 0 on error
|
|
|
|
|
2019-03-03 07:01:16 -07:00
|
|
|
See also: ~
|
|
|
|
buf_open_scratch
|
|
|
|
|
2019-03-16 05:57:50 -07:00
|
|
|
nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
|
2019-03-12 05:46:02 -07:00
|
|
|
Open a new window.
|
|
|
|
|
|
|
|
Currently this is used to open floating and external windows.
|
|
|
|
Floats are windows that are drawn above the split layout, at
|
|
|
|
some anchor position in some other window. Floats can be draw
|
|
|
|
internally or by external GUI with the |ui-multigrid|
|
|
|
|
extension. External windows are only supported with multigrid
|
|
|
|
GUIs, and are displayed as separate top-level windows.
|
|
|
|
|
|
|
|
For a general overview of floats, see |api-floatwin|.
|
|
|
|
|
|
|
|
Exactly one of `external` and `relative` must be specified.
|
2019-04-08 14:08:01 -07:00
|
|
|
The `width` and `height` of the new window must be specified.
|
2019-03-12 05:46:02 -07:00
|
|
|
|
|
|
|
With editor positioning row=0, col=0 refers to the top-left
|
|
|
|
corner of the screen-grid and row=Lines-1, Columns-1 refers to
|
|
|
|
the bottom-right corner. Floating point values are allowed,
|
|
|
|
but the builtin implementation (used by TUI and GUIs without
|
|
|
|
multigrid support) will always round down to nearest integer.
|
|
|
|
|
|
|
|
Out-of-bounds values, and configurations that make the float
|
|
|
|
not fit inside the main editor, are allowed. The builtin
|
|
|
|
implementation will truncate values so floats are completely
|
|
|
|
within the main screen grid. External GUIs could let floats
|
|
|
|
hover outside of the main window like a tooltip, but this
|
|
|
|
should not be used to specify arbitrary WM screen positions.
|
|
|
|
|
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} handle of buffer to be displayed in the window
|
|
|
|
{enter} whether the window should be entered (made the
|
|
|
|
current window)
|
|
|
|
{config} Dictionary for the window configuration accepts
|
|
|
|
these keys:
|
|
|
|
- `relative` : If set, the window becomes a floating
|
|
|
|
window. The window will be placed with row,col
|
|
|
|
coordinates relative to one of the following:
|
|
|
|
- "editor" the global editor grid
|
|
|
|
- "win" a window. Use `win` to specify a
|
|
|
|
window id, or the current window will be
|
|
|
|
used by default. "cursor" the cursor
|
|
|
|
position in current window.
|
|
|
|
|
|
|
|
- `win` : When using relative='win', window id
|
|
|
|
of the window where the position is defined.
|
|
|
|
- `anchor` : The corner of the float that the row,col
|
|
|
|
position defines:
|
|
|
|
- "NW" north-west (default)
|
|
|
|
- "NE" north-east
|
|
|
|
- "SW" south-west
|
|
|
|
- "SE" south-east
|
|
|
|
|
|
|
|
- `height` : window height (in character cells).
|
|
|
|
Minimum of 1.
|
|
|
|
- `width` : window width (in character cells).
|
2019-04-08 14:08:01 -07:00
|
|
|
Minimum of 1.
|
2019-03-03 07:01:16 -07:00
|
|
|
- `row` : row position. Screen cell height are
|
|
|
|
used as unit. Can be floating point.
|
|
|
|
- `col` : column position. Screen cell width is
|
|
|
|
used as unit. Can be floating point.
|
|
|
|
- `focusable` : Whether window can be focused by
|
|
|
|
wincmds and mouse events. Defaults to true.
|
|
|
|
Even if set to false, the window can still be
|
|
|
|
entered using |nvim_set_current_win()| API
|
|
|
|
call.
|
|
|
|
- `external` : GUI should display the window as
|
|
|
|
an external top-level window. Currently
|
|
|
|
accepts no other positioning configuration
|
|
|
|
together with this.
|
|
|
|
|
|
|
|
Return: ~
|
|
|
|
Window handle, or 0 on error
|
2019-03-12 05:46:02 -07:00
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_list_tabpages() *nvim_list_tabpages()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets the current list of tabpage handles.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
List of tabpage handles
|
|
|
|
|
|
|
|
nvim_get_current_tabpage() *nvim_get_current_tabpage()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets the current tabpage.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Tabpage handle
|
|
|
|
|
|
|
|
nvim_set_current_tabpage({tabpage}) *nvim_set_current_tabpage()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Sets the current tabpage.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{tabpage} Tabpage handle
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-11-15 18:00:04 -07:00
|
|
|
nvim_create_namespace({name}) *nvim_create_namespace()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Creates a new namespace, or gets an existing one.
|
2018-11-15 18:00:04 -07:00
|
|
|
|
2018-12-08 17:49:59 -07:00
|
|
|
Namespaces are used for buffer highlights and virtual text,
|
|
|
|
see |nvim_buf_add_highlight()| and
|
|
|
|
|nvim_buf_set_virtual_text()|.
|
2018-11-15 18:00:04 -07:00
|
|
|
|
2018-12-08 17:49:59 -07:00
|
|
|
Namespaces can be named or anonymous. If `name` matches an
|
|
|
|
existing namespace, the associated id is returned. If `name`
|
|
|
|
is an empty string a new, anonymous namespace is created.
|
2018-11-15 18:00:04 -07:00
|
|
|
|
|
|
|
Parameters: ~
|
2018-12-08 17:49:59 -07:00
|
|
|
{name} Namespace name or empty string
|
2018-11-15 18:00:04 -07:00
|
|
|
|
|
|
|
Return: ~
|
2018-12-08 17:49:59 -07:00
|
|
|
Namespace id
|
2018-11-15 18:00:04 -07:00
|
|
|
|
|
|
|
nvim_get_namespaces() *nvim_get_namespaces()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Gets existing, non-anonymous namespaces.
|
2018-11-15 18:00:04 -07:00
|
|
|
|
|
|
|
Return: ~
|
|
|
|
dict that maps from names to namespace ids.
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_subscribe({event}) *nvim_subscribe()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Subscribes to event broadcasts.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{event} Event type string
|
|
|
|
|
|
|
|
nvim_unsubscribe({event}) *nvim_unsubscribe()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Unsubscribes to event broadcasts.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{event} Event type string
|
|
|
|
|
|
|
|
nvim_get_color_by_name({name}) *nvim_get_color_by_name()*
|
2019-04-27 08:53:56 -07:00
|
|
|
Returns the 24-bit RGB value of a |nvim_get_color_map()| color
|
|
|
|
name or "#rrggbb" hexadecimal string.
|
|
|
|
|
|
|
|
Examples::echo nvim_get_color_by_name("Pink") :echo
|
|
|
|
nvim_get_color_by_name("#cbcbcb")
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{name} Color name or "#rrggbb" string
|
|
|
|
|
|
|
|
Return: ~
|
|
|
|
24-bit RGB value, or -1 for invalid argument.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
nvim_get_color_map() *nvim_get_color_map()*
|
2019-04-27 08:53:56 -07:00
|
|
|
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).
|
|
|
|
|
|
|
|
Return: ~
|
|
|
|
Map of color names and RGB values.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2017-05-01 09:52:56 -07:00
|
|
|
nvim_get_mode() *nvim_get_mode()*
|
2017-11-05 18:00:39 -07:00
|
|
|
Gets the current mode. |mode()| "blocking" is true if Nvim is
|
|
|
|
waiting for input.
|
2017-05-01 09:52:56 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-05-01 09:52:56 -07:00
|
|
|
Dictionary { "mode": String, "blocking": Boolean }
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Attributes: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{async}
|
|
|
|
|
2017-07-02 04:46:41 -07:00
|
|
|
nvim_get_keymap({mode}) *nvim_get_keymap()*
|
2018-06-10 15:20:39 -07:00
|
|
|
Gets a list of global (non-buffer-local) |mapping|
|
|
|
|
definitions.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{mode} Mode short-name ("n", "i", "v", ...)
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Array of maparg()-like dictionaries describing mappings.
|
|
|
|
The "buffer" key is always zero.
|
|
|
|
|
|
|
|
nvim_get_commands({opts}) *nvim_get_commands()*
|
|
|
|
Gets a map of global (non-buffer-local) Ex commands.
|
|
|
|
|
|
|
|
Currently only |user-commands| are supported, not builtin Ex
|
|
|
|
commands.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
{opts} Optional parameters. Currently only supports
|
|
|
|
{"builtin":false}
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Map of maps describing commands.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_get_api_info() *nvim_get_api_info()*
|
2017-12-09 17:24:54 -07:00
|
|
|
Returns a 2-tuple (Array), where item 0 is the current channel
|
|
|
|
id and item 1 is the |api-metadata| map (Dictionary).
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-12-09 17:24:54 -07:00
|
|
|
2-tuple [{channel-id}, {api-metadata}]
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Attributes: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{async}
|
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
*nvim_set_client_info()*
|
|
|
|
nvim_set_client_info({name}, {version}, {type}, {methods},
|
|
|
|
{attributes})
|
2019-03-03 07:01:16 -07:00
|
|
|
Identifies the client. Can be called more than once;
|
|
|
|
subsequent calls remove earlier info, which should be included
|
|
|
|
by the caller if it is still valid. (E.g. if a library first
|
|
|
|
identifies the channel, then a plugin using that library later
|
|
|
|
overrides that info)
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{name} Short name for the connected client
|
|
|
|
{version} Dictionary 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
|
|
|
|
prerelease, like "dev" or "beta1"
|
|
|
|
- "commit" hash or similar identifier of
|
|
|
|
commit
|
|
|
|
{type} Must be one of the following values. Client
|
|
|
|
libraries should default to "remote" unless
|
|
|
|
overridden by the user.
|
|
|
|
- "remote" remote client connected to Nvim.
|
|
|
|
- "ui" gui frontend
|
|
|
|
- "embedder" application using Nvim as a
|
|
|
|
component (for example, IDE/editor
|
|
|
|
implementing a vim mode).
|
|
|
|
- "host" plugin host, typically started by
|
|
|
|
nvim
|
|
|
|
- "plugin" single plugin, started by nvim
|
2018-06-10 15:20:39 -07:00
|
|
|
{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
|
2019-03-03 07:01:16 -07:00
|
|
|
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):
|
|
|
|
- "async" if true, send as a notification.
|
|
|
|
If false or unspecified, use a blocking
|
|
|
|
request
|
|
|
|
- "nargs" Number of arguments. Could be a
|
|
|
|
single integer or an array of two
|
|
|
|
integers, minimum and maximum inclusive.
|
|
|
|
{attributes} Arbitrary string:string map of informal
|
|
|
|
client properties. Suggested keys:
|
|
|
|
- "website": Client homepage URL (e.g.
|
|
|
|
GitHub repository)
|
|
|
|
- "license": License description ("Apache
|
|
|
|
2", "GPLv3", "MIT", …)
|
|
|
|
- "logo": URI or path to image, preferably
|
|
|
|
small logo or icon. .png or .svg format is
|
|
|
|
preferred.
|
2018-06-10 15:20:39 -07:00
|
|
|
|
|
|
|
nvim_get_chan_info({chan}) *nvim_get_chan_info()*
|
|
|
|
Get information about a channel.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
Dictionary describing a channel, with these keys:
|
|
|
|
- "stream" the stream underlying the channel
|
|
|
|
- "stdio" stdin and stdout of this Nvim instance
|
|
|
|
- "stderr" stderr of this Nvim instance
|
|
|
|
- "socket" TCP/IP socket or named pipe
|
|
|
|
- "job" job with communication over its stdio
|
|
|
|
|
|
|
|
- "mode" how data received on the channel is interpreted
|
|
|
|
- "bytes" send and receive raw bytes
|
|
|
|
- "terminal" a |terminal| instance interprets ASCII
|
|
|
|
sequences
|
|
|
|
- "rpc" |RPC| communication on the channel is active
|
|
|
|
|
|
|
|
- "pty" Name of pseudoterminal, if one is used (optional).
|
|
|
|
On a POSIX system, this will be a device path like
|
|
|
|
/dev/pts/1. Even if the name is unknown, the key will
|
|
|
|
still be present to indicate a pty is used. This is
|
|
|
|
currently the case when using winpty on windows.
|
|
|
|
- "buffer" buffer with connected |terminal| instance
|
|
|
|
(optional)
|
|
|
|
- "client" information about the client on the other end
|
|
|
|
of the RPC channel, if it has added it using
|
|
|
|
|nvim_set_client_info()|. (optional)
|
2018-06-10 15:20:39 -07:00
|
|
|
|
|
|
|
nvim_list_chans() *nvim_list_chans()*
|
|
|
|
Get information about all open channels.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Array of Dictionaries, each describing a channel with the
|
2018-08-25 07:38:24 -07:00
|
|
|
format specified at |nvim_get_chan_info()|.
|
2018-06-10 15:20:39 -07:00
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_call_atomic({calls}) *nvim_call_atomic()*
|
2018-06-10 15:20:39 -07:00
|
|
|
Calls many API methods atomically.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
This has two main usages:
|
2019-03-20 04:44:06 -07:00
|
|
|
1. To perform several requests from an async context
|
2019-03-03 07:01:16 -07:00
|
|
|
atomically, i.e. without interleaving redraws, RPC requests
|
|
|
|
from other clients, or user interactions (however API
|
|
|
|
methods may trigger autocommands or event processing which
|
|
|
|
have such side-effects, e.g. |:sleep| may wake timers).
|
2019-03-20 04:44:06 -07:00
|
|
|
2. To minimize RPC overhead (roundtrips) of a sequence of many
|
2019-03-03 07:01:16 -07:00
|
|
|
requests.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{calls} an array of calls, where each call is described
|
|
|
|
by an array with two elements: the request name,
|
|
|
|
and an array of arguments.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
Array of two elements. The first is an array of return
|
|
|
|
values. The second is NIL if all calls succeeded. If a
|
|
|
|
call resulted in an error, it is a three-element array
|
|
|
|
with the zero-based index of the call which resulted in an
|
|
|
|
error, the error type and the error message. If an error
|
|
|
|
occurred, the values from all preceding calls will still
|
|
|
|
be returned.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2017-11-14 02:47:49 -07:00
|
|
|
*nvim_parse_expression()*
|
|
|
|
nvim_parse_expression({expr}, {flags}, {highlight})
|
2019-01-10 17:20:15 -07:00
|
|
|
Parse a VimL expression.
|
2017-11-14 02:47:49 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Attributes: ~
|
2017-11-14 02:47:49 -07:00
|
|
|
{async}
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{expr} Expression to parse. Always treated as a
|
2017-11-14 02:47:49 -07:00
|
|
|
single line.
|
2019-03-03 07:01:16 -07:00
|
|
|
{flags} Flags:
|
|
|
|
- "m" if multiple expressions in a row are
|
|
|
|
allowed (only the first one will be
|
|
|
|
parsed),
|
|
|
|
- "E" if EOC tokens are not allowed
|
|
|
|
(determines whether they will stop parsing
|
|
|
|
process or be recognized as an
|
|
|
|
operator/space, though also yielding an
|
|
|
|
error).
|
|
|
|
- "l" when needing to start parsing with
|
|
|
|
lvalues for ":let" or ":for". Common flag
|
|
|
|
sets:
|
|
|
|
- "m" to parse like for ":echo".
|
|
|
|
- "E" to parse like for "<C-r>=".
|
|
|
|
- empty string for ":call".
|
|
|
|
- "lm" to parse for ":let".
|
2017-11-14 02:47:49 -07:00
|
|
|
{highlight} If true, return value will also include
|
|
|
|
"highlight" key containing array of 4-tuples
|
|
|
|
(arrays) (Integer, Integer, Integer, String),
|
|
|
|
where first three numbers define the
|
|
|
|
highlighted region and represent line,
|
|
|
|
starting column and ending column (latter
|
|
|
|
exclusive: one should highlight region
|
|
|
|
[start_col, end_col)).
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
|
|
|
|
- AST: top-level dictionary with these keys:
|
|
|
|
- "error": Dictionary with error, present only if parser
|
|
|
|
saw some error. Contains the following keys:
|
|
|
|
- "message": String, error message in printf format,
|
|
|
|
translated. Must contain exactly one "%.*s".
|
|
|
|
- "arg": String, error message argument.
|
|
|
|
|
|
|
|
- "len": Amount of bytes successfully parsed. With flags
|
|
|
|
equal to "" that should be equal to the length of expr
|
|
|
|
string. (“Sucessfully parsed” here means “participated
|
|
|
|
in AST creation”, not “till the first error”.)
|
|
|
|
- "ast": AST, either nil or a dictionary with these
|
|
|
|
keys:
|
|
|
|
- "type": node type, one of the value names from
|
|
|
|
ExprASTNodeType stringified without "kExprNode"
|
|
|
|
prefix.
|
|
|
|
- "start": a pair [line, column] describing where node
|
|
|
|
is "started" where "line" is always 0 (will not be 0
|
|
|
|
if you will be using nvim_parse_viml() on e.g.
|
|
|
|
":let", but that is not present yet). Both elements
|
|
|
|
are Integers.
|
|
|
|
- "len": “length” of the node. This and "start" are
|
|
|
|
there for debugging purposes primary (debugging
|
|
|
|
parser and providing debug information).
|
|
|
|
- "children": a list of nodes described in top/"ast".
|
|
|
|
There always is zero, one or two children, key will
|
|
|
|
not be present if node has no children. Maximum
|
|
|
|
number of children may be found in node_maxchildren
|
|
|
|
array.
|
|
|
|
|
|
|
|
- Local values (present only for certain nodes):
|
|
|
|
- "scope": a single Integer, specifies scope for
|
|
|
|
"Option" and "PlainIdentifier" nodes. For "Option" it
|
|
|
|
is one of ExprOptScope values, for "PlainIdentifier"
|
|
|
|
it is one of ExprVarScope values.
|
|
|
|
- "ident": identifier (without scope, if any), present
|
|
|
|
for "Option", "PlainIdentifier", "PlainKey" and
|
|
|
|
"Environment" nodes.
|
|
|
|
- "name": Integer, register name (one character) or -1.
|
|
|
|
Only present 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.
|
2017-11-14 02:47:49 -07:00
|
|
|
|
2017-07-02 04:46:41 -07:00
|
|
|
nvim__id({obj}) *nvim__id()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Returns object given as argument.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
|
|
|
This API function is used for testing. One should not rely on
|
|
|
|
its presence in plugins.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
{obj} Object to return.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
its argument.
|
|
|
|
|
|
|
|
nvim__id_array({arr}) *nvim__id_array()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Returns array given as argument.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
|
|
|
This API function is used for testing. One should not rely on
|
|
|
|
its presence in plugins.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
{arr} Array to return.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
its argument.
|
|
|
|
|
|
|
|
nvim__id_dictionary({dct}) *nvim__id_dictionary()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Returns dictionary given as argument.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
|
|
|
This API function is used for testing. One should not rely on
|
|
|
|
its presence in plugins.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
{dct} Dictionary to return.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
its argument.
|
|
|
|
|
|
|
|
nvim__id_float({flt}) *nvim__id_float()*
|
2019-01-10 17:20:15 -07:00
|
|
|
Returns floating-point value given as argument.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
|
|
|
This API function is used for testing. One should not rely on
|
|
|
|
its presence in plugins.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
{flt} Value to return.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-07-02 04:46:41 -07:00
|
|
|
its argument.
|
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
nvim__stats() *nvim__stats()*
|
|
|
|
Gets internal stats.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Map of various internal stats.
|
|
|
|
|
|
|
|
nvim_list_uis() *nvim_list_uis()*
|
|
|
|
Gets a list of dictionaries representing attached UIs.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
Array of UI dictionaries, each with these keys:
|
|
|
|
- "height" requested height of the UI
|
|
|
|
- "width" requested width of the UI
|
2019-03-26 14:55:46 -07:00
|
|
|
- "rgb" true if the UI uses RGB colors (false implies
|
|
|
|
|cterm-colors|)
|
2019-03-03 07:01:16 -07:00
|
|
|
- "ext_..." Requested UI extensions, see |ui-options|
|
|
|
|
- "chan" Channel id of remote UI (not present for TUI)
|
2018-06-10 15:20:39 -07:00
|
|
|
|
|
|
|
nvim_get_proc_children({pid}) *nvim_get_proc_children()*
|
2019-03-03 07:01:16 -07:00
|
|
|
Gets the immediate children of process `pid` .
|
2018-06-10 15:20:39 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Array of child process ids, empty if process not found.
|
|
|
|
|
|
|
|
nvim_get_proc({pid}) *nvim_get_proc()*
|
2019-03-03 07:01:16 -07:00
|
|
|
Gets info describing process `pid` .
|
2018-06-10 15:20:39 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Map of process properties, or NIL if process not found.
|
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
*nvim_select_popupmenu_item()*
|
|
|
|
nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts})
|
|
|
|
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.
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{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.
|
2019-03-03 07:01:16 -07:00
|
|
|
Implies `insert` .
|
2019-01-10 17:20:15 -07:00
|
|
|
{opts} Optional parameters. Reserved for future use.
|
|
|
|
|
2018-07-24 21:13:51 -07:00
|
|
|
nvim__inspect_cell({row}, {col}) *nvim__inspect_cell()*
|
|
|
|
TODO: Documentation
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
Buffer Functions *api-buffer*
|
|
|
|
|
2018-07-24 21:13:51 -07:00
|
|
|
Unloaded Buffers:~
|
|
|
|
|
|
|
|
Buffers may be unloaded by the |:bunload| command or the
|
|
|
|
buffer's |'bufhidden'| option. When a buffer is unloaded its
|
|
|
|
file contents are freed from memory and vim cannot operate on
|
|
|
|
the buffer lines until it is reloaded (usually by opening the
|
|
|
|
buffer again in a new window). API methods such as
|
|
|
|
|nvim_buf_get_lines()| and |nvim_buf_line_count()| will be
|
|
|
|
affected.
|
|
|
|
|
|
|
|
You can use |nvim_buf_is_loaded()| or |nvim_buf_line_count()|
|
|
|
|
to check whether a buffer is loaded.
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_buf_line_count({buffer}) *nvim_buf_line_count()*
|
|
|
|
Gets the buffer line count
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-11-04 19:50:22 -07:00
|
|
|
Line count, or 0 for unloaded buffer. |api-buffer|
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-10 15:20:39 -07:00
|
|
|
nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|
2019-04-08 18:14:27 -07:00
|
|
|
Activates buffer-update events on the channel.
|
2018-06-10 15:20:39 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-06-10 15:20:39 -07:00
|
|
|
{send_buffer} Set to true if the initial notification
|
|
|
|
should contain the whole buffer. If so, the
|
|
|
|
first notification will be a
|
2019-03-03 07:01:16 -07:00
|
|
|
`nvim_buf_lines_event` . Otherwise, the
|
2018-06-10 15:20:39 -07:00
|
|
|
first notification will be a
|
|
|
|
`nvim_buf_changedtick_event`
|
2019-01-10 17:20:15 -07:00
|
|
|
{opts} Optional parameters. Reserved for future
|
|
|
|
use.
|
2018-06-10 15:20:39 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
False when updates couldn't be enabled because the buffer
|
2019-03-03 07:01:16 -07:00
|
|
|
isn't loaded or `opts` contained an invalid key; otherwise
|
2018-06-10 15:20:39 -07:00
|
|
|
True.
|
|
|
|
|
|
|
|
nvim_buf_detach({buffer}) *nvim_buf_detach()*
|
2019-04-08 18:14:27 -07:00
|
|
|
Deactivates buffer-update events on the channel.
|
2018-06-10 15:20:39 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-06-10 15:20:39 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
False when updates couldn't be disabled because the buffer
|
|
|
|
isn't loaded; otherwise True.
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
*nvim_buf_get_lines()*
|
|
|
|
nvim_buf_get_lines({buffer}, {start}, {end}, {strict_indexing})
|
2018-06-29 10:27:50 -07:00
|
|
|
Gets a line-range from the buffer.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
Indexing is zero-based, end-exclusive. Negative indices are
|
2018-06-29 10:27:50 -07:00
|
|
|
interpreted as length+1+index: -1 refers to the index past the
|
|
|
|
end. So to get the last element use start=-2 and end=-1.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
Out-of-bounds indices are clamped to the nearest valid value,
|
|
|
|
unless `strict_indexing` is set.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{start} First line index
|
|
|
|
{end} Last line index (exclusive)
|
|
|
|
{strict_indexing} Whether out-of-bounds should be an
|
|
|
|
error.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-11-04 19:50:22 -07:00
|
|
|
Array of lines, or empty array for unloaded buffer.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
*nvim_buf_set_lines()*
|
|
|
|
nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing},
|
|
|
|
{replacement})
|
2018-06-29 10:27:50 -07:00
|
|
|
Sets (replaces) a line-range in the buffer.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
Indexing is zero-based, end-exclusive. Negative indices are
|
2018-06-29 10:27:50 -07:00
|
|
|
interpreted as length+1+index: -1 refers to the index past the
|
|
|
|
end. So to change or delete the last element use start=-2 and
|
|
|
|
end=-1.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
To insert lines at a given index, set `start` and `end` to the
|
|
|
|
same index. To delete a range of lines, set `replacement` to
|
2017-03-01 09:18:03 -07:00
|
|
|
an empty array.
|
|
|
|
|
|
|
|
Out-of-bounds indices are clamped to the nearest valid value,
|
|
|
|
unless `strict_indexing` is set.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{start} First line index
|
|
|
|
{end} Last line index (exclusive)
|
|
|
|
{strict_indexing} Whether out-of-bounds should be an
|
|
|
|
error.
|
|
|
|
{replacement} Array of lines to use as replacement
|
|
|
|
|
2018-11-04 19:50:22 -07:00
|
|
|
nvim_buf_get_offset({buffer}, {index}) *nvim_buf_get_offset()*
|
|
|
|
Returns the byte offset for a line.
|
|
|
|
|
|
|
|
Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is
|
|
|
|
one byte. 'fileformat' and 'fileencoding' are ignored. The
|
|
|
|
line index just after the last line gives the total byte-count
|
|
|
|
of the buffer. A final EOL byte is counted if it would be
|
|
|
|
written, see 'eol'.
|
|
|
|
|
|
|
|
Unlike |line2byte()|, throws error for out-of-bounds indexing.
|
|
|
|
Returns -1 for unloaded buffer.
|
|
|
|
|
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-11-04 19:50:22 -07:00
|
|
|
{index} Line index
|
|
|
|
|
|
|
|
Return: ~
|
|
|
|
Integer byte offset, or -1 for unloaded buffer.
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()*
|
|
|
|
Gets a buffer-scoped (b:) variable.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Variable name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Variable value
|
|
|
|
|
|
|
|
nvim_buf_get_changedtick({buffer}) *nvim_buf_get_changedtick()*
|
|
|
|
Gets a changed tick of a buffer
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
`b:changedtick` value.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2017-07-02 04:46:41 -07:00
|
|
|
nvim_buf_get_keymap({buffer}, {mode}) *nvim_buf_get_keymap()*
|
2018-06-10 15:20:39 -07:00
|
|
|
Gets a list of buffer-local |mapping| definitions.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-11-05 18:00:39 -07:00
|
|
|
{mode} Mode short-name ("n", "i", "v", ...)
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Array of maparg()-like dictionaries describing mappings.
|
|
|
|
The "buffer" key holds the associated buffer handle.
|
|
|
|
|
|
|
|
nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()*
|
|
|
|
Gets a map of buffer-local |user-commands|.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-06-10 15:20:39 -07:00
|
|
|
{opts} Optional parameters. Currently not used.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-06-10 15:20:39 -07:00
|
|
|
Map of maps describing commands.
|
2017-07-02 04:46:41 -07:00
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()*
|
|
|
|
Sets a buffer-scoped (b:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Variable name
|
|
|
|
{value} Variable value
|
|
|
|
|
|
|
|
nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()*
|
|
|
|
Removes a buffer-scoped (b:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Variable name
|
|
|
|
|
|
|
|
nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()*
|
|
|
|
Gets a buffer option value
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Option name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Option value
|
|
|
|
|
|
|
|
nvim_buf_set_option({buffer}, {name}, {value}) *nvim_buf_set_option()*
|
|
|
|
Sets a buffer option value. Passing 'nil' as value deletes the
|
|
|
|
option (only works if there's a global fallback)
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Option name
|
|
|
|
{value} Option value
|
|
|
|
|
|
|
|
nvim_buf_get_name({buffer}) *nvim_buf_get_name()*
|
|
|
|
Gets the full file name for the buffer
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Buffer name
|
|
|
|
|
|
|
|
nvim_buf_set_name({buffer}, {name}) *nvim_buf_set_name()*
|
|
|
|
Sets the full file name for a buffer
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Buffer name
|
|
|
|
|
2018-07-24 21:13:51 -07:00
|
|
|
nvim_buf_is_loaded({buffer}) *nvim_buf_is_loaded()*
|
|
|
|
Checks if a buffer is valid and loaded. See |api-buffer| for
|
|
|
|
more info about unloaded buffers.
|
|
|
|
|
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-07-24 21:13:51 -07:00
|
|
|
|
|
|
|
Return: ~
|
|
|
|
true if the buffer is valid and loaded, false otherwise.
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_buf_is_valid({buffer}) *nvim_buf_is_valid()*
|
2018-07-24 21:13:51 -07:00
|
|
|
Checks if a buffer is valid.
|
|
|
|
|
|
|
|
Note:
|
|
|
|
Even if a buffer is valid it may have been unloaded. See
|
|
|
|
|api-buffer| for more info about unloaded buffers.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-07-24 21:13:51 -07:00
|
|
|
true if the buffer is valid, false otherwise.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
nvim_buf_get_mark({buffer}, {name}) *nvim_buf_get_mark()*
|
|
|
|
Return a tuple (row,col) representing the position of the
|
|
|
|
named mark
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2017-03-01 09:18:03 -07:00
|
|
|
{name} Mark name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
(row, col) tuple
|
|
|
|
|
|
|
|
*nvim_buf_add_highlight()*
|
2018-11-15 18:00:04 -07:00
|
|
|
nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line},
|
2017-03-01 09:18:03 -07:00
|
|
|
{col_start}, {col_end})
|
|
|
|
Adds a highlight to buffer.
|
|
|
|
|
2017-11-05 18:00:39 -07:00
|
|
|
Useful for plugins that dynamically generate highlights to a
|
|
|
|
buffer (like a semantic highlighter or linter). The function
|
2018-11-15 18:00:04 -07:00
|
|
|
adds a single highlight to a buffer. Unlike |matchaddpos()|
|
2017-11-05 18:00:39 -07:00
|
|
|
highlights follow changes to line numbering (as lines are
|
|
|
|
inserted/removed above the highlighted line), like signs and
|
|
|
|
marks do.
|
|
|
|
|
2018-11-15 18:00:04 -07:00
|
|
|
Namespaces are used for batch deletion/updating of a set of
|
|
|
|
highlights. To create a namespace, use |nvim_create_namespace|
|
|
|
|
which returns a namespace id. Pass it in to this function as
|
|
|
|
`ns_id` to add highlights to the namespace. All highlights in
|
|
|
|
the same namespace can then be cleared with single call to
|
2018-12-08 17:31:34 -07:00
|
|
|
|nvim_buf_clear_namespace|. If the highlight never will be
|
2019-03-03 07:01:16 -07:00
|
|
|
deleted by an API call, pass `ns_id = -1` .
|
2018-11-15 18:00:04 -07:00
|
|
|
|
|
|
|
As a shorthand, `ns_id = 0` can be used to create a new
|
|
|
|
namespace for the highlight, the allocated id is then
|
|
|
|
returned. If `hl_group` is the empty string no highlight is
|
|
|
|
added, but a new `ns_id` is still returned. This is supported
|
|
|
|
for backwards compatibility, new code should use
|
|
|
|
|nvim_create_namespace| to create a new empty namespace.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-11-15 18:00:04 -07:00
|
|
|
{ns_id} namespace to use or -1 for ungrouped
|
|
|
|
highlight
|
2017-03-01 09:18:03 -07:00
|
|
|
{hl_group} Name of the highlight group to use
|
2017-11-05 18:00:39 -07:00
|
|
|
{line} Line to highlight (zero-indexed)
|
2017-11-14 02:47:49 -07:00
|
|
|
{col_start} Start of (byte-indexed) column range to
|
|
|
|
highlight
|
|
|
|
{col_end} End of (byte-indexed) column range to
|
|
|
|
highlight, or -1 to highlight to end of line
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2018-11-15 18:00:04 -07:00
|
|
|
The ns_id that was used
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-12-08 17:31:34 -07:00
|
|
|
*nvim_buf_clear_namespace()*
|
|
|
|
nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
|
|
|
|
Clears namespaced objects, highlights and virtual text, from a
|
|
|
|
line range
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-12-08 17:31:34 -07:00
|
|
|
To clear the namespace in the entire buffer, pass in 0 and -1
|
2017-03-01 09:18:03 -07:00
|
|
|
to line_start and line_end respectively.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-12-08 17:31:34 -07:00
|
|
|
{ns_id} Namespace to clear, or -1 to clear all
|
|
|
|
namespaces.
|
2017-03-01 09:18:03 -07:00
|
|
|
{line_start} Start of range of lines to clear
|
|
|
|
{line_end} End of range of lines to clear (exclusive)
|
2018-12-08 17:31:34 -07:00
|
|
|
or -1 to clear to end of buffer.
|
2017-03-01 09:18:03 -07:00
|
|
|
|
2018-08-04 18:17:08 -07:00
|
|
|
*nvim_buf_set_virtual_text()*
|
2018-11-15 18:00:04 -07:00
|
|
|
nvim_buf_set_virtual_text({buffer}, {ns_id}, {line}, {chunks}, {opts})
|
2018-08-04 18:17:08 -07:00
|
|
|
Set the virtual text (annotation) for a buffer line.
|
|
|
|
|
|
|
|
By default (and currently the only option) the text will be
|
|
|
|
placed after the buffer text. Virtual text will never cause
|
|
|
|
reflow, rather virtual text will be truncated at the end of
|
2019-01-26 12:10:59 -07:00
|
|
|
the screen line. The virtual text will begin one cell
|
|
|
|
(|lcs-eol| or space) after the ordinary text.
|
2018-08-04 18:17:08 -07:00
|
|
|
|
2018-11-15 18:00:04 -07:00
|
|
|
Namespaces are used to support batch deletion/updating of
|
|
|
|
virtual text. To create a namespace, use
|
|
|
|
|nvim_create_namespace|. Virtual text is cleared using
|
2018-12-08 17:31:34 -07:00
|
|
|
|nvim_buf_clear_namespace|. The same `ns_id` can be used for
|
2018-11-15 18:00:04 -07:00
|
|
|
both virtual text and highlights added by
|
|
|
|
|nvim_buf_add_highlight|, both can then be cleared with a
|
2018-12-08 17:31:34 -07:00
|
|
|
single call to |nvim_buf_clear_namespace|. If the virtual text
|
2019-03-03 07:01:16 -07:00
|
|
|
never will be cleared by an API call, pass `ns_id = -1` .
|
2018-11-15 18:00:04 -07:00
|
|
|
|
|
|
|
As a shorthand, `ns_id = 0` can be used to create a new
|
|
|
|
namespace for the virtual text, the allocated id is then
|
|
|
|
returned.
|
2018-11-04 19:50:22 -07:00
|
|
|
|
2018-08-04 18:17:08 -07:00
|
|
|
Parameters: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
{buffer} Buffer handle, or 0 for current buffer
|
2018-11-15 18:00:04 -07:00
|
|
|
{ns_id} Namespace to use or 0 to create a namespace, or
|
2018-08-04 18:17:08 -07:00
|
|
|
-1 for a ungrouped annotation
|
2019-01-26 12:10:59 -07:00
|
|
|
{line} Line to annotate with virtual text
|
|
|
|
(zero-indexed)
|
2018-08-04 18:17:08 -07:00
|
|
|
{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.
|
|
|
|
{opts} Optional parameters. Currently not used.
|
|
|
|
|
|
|
|
Return: ~
|
2018-11-15 18:00:04 -07:00
|
|
|
The ns_id that was used
|
2018-08-04 18:17:08 -07:00
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
Window Functions *api-window*
|
|
|
|
|
|
|
|
nvim_win_get_buf({window}) *nvim_win_get_buf()*
|
|
|
|
Gets the current buffer in a window
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Buffer handle
|
|
|
|
|
2018-11-15 18:00:04 -07:00
|
|
|
nvim_win_set_buf({window}, {buffer}) *nvim_win_set_buf()*
|
|
|
|
Sets the current buffer in a window, without side-effects
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{window} Window handle
|
|
|
|
{buffer} Buffer handle
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_win_get_cursor({window}) *nvim_win_get_cursor()*
|
|
|
|
Gets the cursor position in the window
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
(row, col) tuple
|
|
|
|
|
|
|
|
nvim_win_set_cursor({window}, {pos}) *nvim_win_set_cursor()*
|
|
|
|
Sets the cursor position in the window
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{pos} (row, col) tuple representing the new position
|
|
|
|
|
|
|
|
nvim_win_get_height({window}) *nvim_win_get_height()*
|
|
|
|
Gets the window height
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Height as a count of rows
|
|
|
|
|
|
|
|
nvim_win_set_height({window}, {height}) *nvim_win_set_height()*
|
|
|
|
Sets the window height. This will only succeed if the screen
|
|
|
|
is split horizontally.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{height} Height as a count of rows
|
|
|
|
|
|
|
|
nvim_win_get_width({window}) *nvim_win_get_width()*
|
|
|
|
Gets the window width
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Width as a count of columns
|
|
|
|
|
|
|
|
nvim_win_set_width({window}, {width}) *nvim_win_set_width()*
|
|
|
|
Sets the window width. This will only succeed if the screen is
|
|
|
|
split vertically.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{width} Width as a count of columns
|
|
|
|
|
|
|
|
nvim_win_get_var({window}, {name}) *nvim_win_get_var()*
|
|
|
|
Gets a window-scoped (w:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{name} Variable name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Variable value
|
|
|
|
|
|
|
|
nvim_win_set_var({window}, {name}, {value}) *nvim_win_set_var()*
|
|
|
|
Sets a window-scoped (w:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{name} Variable name
|
|
|
|
{value} Variable value
|
|
|
|
|
|
|
|
nvim_win_del_var({window}, {name}) *nvim_win_del_var()*
|
|
|
|
Removes a window-scoped (w:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{name} Variable name
|
|
|
|
|
|
|
|
nvim_win_get_option({window}, {name}) *nvim_win_get_option()*
|
|
|
|
Gets a window option value
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{name} Option name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Option value
|
|
|
|
|
|
|
|
nvim_win_set_option({window}, {name}, {value}) *nvim_win_set_option()*
|
|
|
|
Sets a window option value. Passing 'nil' as value deletes the
|
|
|
|
option(only works if there's a global fallback)
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
{name} Option name
|
|
|
|
{value} Option value
|
|
|
|
|
|
|
|
nvim_win_get_position({window}) *nvim_win_get_position()*
|
|
|
|
Gets the window position in display cells. First position is
|
|
|
|
zero.
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
(row, col) tuple with the window position
|
|
|
|
|
|
|
|
nvim_win_get_tabpage({window}) *nvim_win_get_tabpage()*
|
|
|
|
Gets the window tabpage
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Tabpage that contains the window
|
|
|
|
|
|
|
|
nvim_win_get_number({window}) *nvim_win_get_number()*
|
|
|
|
Gets the window number
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Window number
|
|
|
|
|
|
|
|
nvim_win_is_valid({window}) *nvim_win_is_valid()*
|
|
|
|
Checks if a window is valid
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{window} Window handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
true if the window is valid, false otherwise
|
|
|
|
|
2019-03-16 05:57:50 -07:00
|
|
|
nvim_win_set_config({window}, {config}) *nvim_win_set_config()*
|
2019-03-12 05:46:02 -07:00
|
|
|
Configure window position. Currently this is only used to
|
|
|
|
configure floating and external windows (including changing a
|
|
|
|
split window to these types).
|
|
|
|
|
|
|
|
See documentation at |nvim_open_win()|, for the meaning of
|
2019-03-16 05:57:50 -07:00
|
|
|
parameters.
|
2019-03-12 05:46:02 -07:00
|
|
|
|
|
|
|
When reconfiguring a floating window, absent option keys will
|
2019-03-03 07:01:16 -07:00
|
|
|
not be changed. The following restriction apply: `row` , `col`
|
2019-03-12 05:46:02 -07:00
|
|
|
and `relative` must be reconfigured together. Only changing a
|
|
|
|
subset of these is an error.
|
|
|
|
|
2019-03-15 10:18:56 -07:00
|
|
|
Parameters: ~
|
2019-03-16 05:57:50 -07:00
|
|
|
{window} Window handle
|
|
|
|
{config} Dictionary of window configuration
|
2019-03-15 10:18:56 -07:00
|
|
|
|
|
|
|
nvim_win_get_config({window}) *nvim_win_get_config()*
|
|
|
|
Return window configuration.
|
|
|
|
|
2019-03-16 05:57:50 -07:00
|
|
|
Return a dictionary containing the same config that can be
|
2019-03-15 10:18:56 -07:00
|
|
|
given to |nvim_open_win()|.
|
|
|
|
|
2019-03-16 05:57:50 -07:00
|
|
|
`relative` will be an empty string for normal windows.
|
2019-03-15 10:18:56 -07:00
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{window} Window handle
|
|
|
|
|
|
|
|
Return: ~
|
|
|
|
Window configuration
|
|
|
|
|
2019-03-12 05:46:02 -07:00
|
|
|
nvim_win_close({window}, {force}) *nvim_win_close()*
|
|
|
|
Close a window.
|
|
|
|
|
|
|
|
This is equivalent to |:close| with count except that it takes
|
|
|
|
a window id.
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{window} Window handle
|
|
|
|
{force} Behave like `:close!` The last window of a
|
|
|
|
buffer with unwritten changes can be closed. The
|
|
|
|
buffer will become hidden, even if 'hidden' is
|
|
|
|
not set.
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
Tabpage Functions *api-tabpage*
|
|
|
|
|
|
|
|
nvim_tabpage_list_wins({tabpage}) *nvim_tabpage_list_wins()*
|
|
|
|
Gets the windows in a tabpage
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{tabpage} Tabpage
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2019-03-03 07:01:16 -07:00
|
|
|
List of windows in `tabpage`
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
nvim_tabpage_get_var({tabpage}, {name}) *nvim_tabpage_get_var()*
|
|
|
|
Gets a tab-scoped (t:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{tabpage} Tabpage handle
|
|
|
|
{name} Variable name
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Variable value
|
|
|
|
|
|
|
|
nvim_tabpage_set_var({tabpage}, {name}, {value}) *nvim_tabpage_set_var()*
|
|
|
|
Sets a tab-scoped (t:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{tabpage} Tabpage handle
|
|
|
|
{name} Variable name
|
|
|
|
{value} Variable value
|
|
|
|
|
|
|
|
nvim_tabpage_del_var({tabpage}, {name}) *nvim_tabpage_del_var()*
|
|
|
|
Removes a tab-scoped (t:) variable
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{tabpage} Tabpage handle
|
|
|
|
{name} Variable name
|
|
|
|
|
|
|
|
nvim_tabpage_get_win({tabpage}) *nvim_tabpage_get_win()*
|
|
|
|
Gets the current window in a tabpage
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{tabpage} Tabpage handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Window handle
|
|
|
|
|
|
|
|
nvim_tabpage_get_number({tabpage}) *nvim_tabpage_get_number()*
|
|
|
|
Gets the tabpage number
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{tabpage} Tabpage handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
Tabpage number
|
|
|
|
|
|
|
|
nvim_tabpage_is_valid({tabpage}) *nvim_tabpage_is_valid()*
|
|
|
|
Checks if a tabpage is valid
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Parameters: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
{tabpage} Tabpage handle
|
|
|
|
|
2018-06-29 10:27:50 -07:00
|
|
|
Return: ~
|
2017-03-01 09:18:03 -07:00
|
|
|
true if the tabpage is valid, false otherwise
|
|
|
|
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
UI Functions *api-ui*
|
|
|
|
|
|
|
|
nvim_ui_attach({width}, {height}, {options}) *nvim_ui_attach()*
|
2019-04-08 18:14:27 -07:00
|
|
|
Activates UI events on the channel.
|
|
|
|
|
|
|
|
Entry point of all UI clients. Allows |--embed| to continue
|
|
|
|
startup. Implies that the client is ready to show the UI. Adds
|
|
|
|
the client to the list of UIs. |nvim_list_uis()|
|
|
|
|
|
|
|
|
Note:
|
|
|
|
If multiple UI clients are attached, the global screen
|
|
|
|
dimensions degrade to the smallest client. E.g. if client
|
|
|
|
A requests 80x40 but client B requests 200x100, the global
|
|
|
|
screen has size 80x40.
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{width} Requested screen columns
|
|
|
|
{height} Requested screen rows
|
|
|
|
{options} |ui-options| map
|
2017-03-01 09:18:03 -07:00
|
|
|
|
|
|
|
nvim_ui_detach() *nvim_ui_detach()*
|
2019-04-08 18:14:27 -07:00
|
|
|
Deactivates UI events on the channel.
|
|
|
|
|
|
|
|
Removes the client from the list of UIs. |nvim_list_uis()|
|
|
|
|
|
2017-03-01 09:18:03 -07:00
|
|
|
nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()*
|
|
|
|
TODO: Documentation
|
|
|
|
|
|
|
|
nvim_ui_set_option({name}, {value}) *nvim_ui_set_option()*
|
|
|
|
TODO: Documentation
|
|
|
|
|
2019-01-10 17:20:15 -07:00
|
|
|
*nvim_ui_try_resize_grid()*
|
|
|
|
nvim_ui_try_resize_grid({grid}, {width}, {height})
|
|
|
|
Tell Nvim to resize a grid. Triggers a grid_resize event with
|
|
|
|
the requested grid size or the maximum size if it exceeds size
|
|
|
|
limits.
|
|
|
|
|
|
|
|
On invalid grid handle, fails with error.
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{grid} The handle of the grid to be changed.
|
|
|
|
{width} The new requested width.
|
|
|
|
{height} The new requested height.
|
|
|
|
|
2017-12-16 13:33:59 -07:00
|
|
|
vim:tw=78:ts=8:ft=help:norl:
|