aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/api.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/api.txt')
-rw-r--r--runtime/doc/api.txt181
1 files changed, 160 insertions, 21 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 717a7caadf..0c17fa1669 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -538,6 +538,21 @@ nvim__screenshot({path}) *nvim__screenshot()*
Attributes: ~
{fast}
+nvim__set_hl_ns({ns_id}) *nvim__set_hl_ns()*
+ 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.
+
+ Attributes: ~
+ {fast}
+
+ Parameters: ~
+ {ns_id} the namespace to activate
+
nvim__stats() *nvim__stats()*
Gets internal stats.
@@ -599,6 +614,22 @@ nvim_call_function({fn}, {args}) *nvim_call_function()*
Return: ~
Result of the function call
+nvim_chan_send({chan}, {data}) *nvim_chan_send()*
+ Send data to channel `id` . For a job, it writes it to the
+ stdin of the process. For the stdio channel |channel-stdio|,
+ it writes to Nvim's stdout. For an internal terminal instance
+ (|nvim_open_term()|) it writes directly to terimal 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.
+
+ Parameters: ~
+ {chan} id of the channel
+ {data} data to write. 8-bit clean: can contain NUL bytes.
+
nvim_command({command}) *nvim_command()*
Executes an ex-command.
@@ -1148,6 +1179,39 @@ nvim_load_context({dict}) *nvim_load_context()*
Parameters: ~
{dict} |Context| map.
+nvim_notify({msg}, {log_level}, {opts}) *nvim_notify()*
+ Notify the user with a message
+
+ Relays the call to vim.notify . By default forwards your
+ message in the echo area but can be overriden to trigger
+ desktop notifications.
+
+ Parameters: ~
+ {msg} Message to display to the user
+ {log_level} The log level
+ {opts} Reserved for future use.
+
+nvim_open_term({buffer}, {opts}) *nvim_open_term()*
+ 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 disply 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()| cal be called immediately to process
+ sequences in a virtual terminal having the intended size.
+
+ Parameters: ~
+ {buffer} the buffer to use (expected to be empty)
+ {opts} Optional parameters. Reserved for future use.
+
nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
Open a new window.
@@ -1247,6 +1311,34 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
and clearing the |EndOfBuffer| region in
'winhighlight'.
+ • `border`: style of (optional) window border. This can
+ either be a string or an array. the string
+ values are:
+ • "none" No border. This is the default
+ • "single" a single line box
+ • "double" a double line box
+ • "shadow" a drop shadow effect by blending
+ with the background. If it is an array it
+ should be an array of eight items or any
+ divisor of eight. The array will specifify
+ the eight chars building up the border in a
+ clockwise fashion starting with the top-left
+ corner. As, an example, the double box style
+ could be specified as: [ "╔", "═" ,"╗", "║",
+ "╝", "═", "╚", "║" ] if the number of chars
+ are less than eight, they will be repeated.
+ Thus an ASCII border could be specified as:
+ [ "/", "-", "\\", "|" ] or all chars the
+ same as: [ "x" ] An empty string can be used
+ to turn off a specific border, for instance:
+ [ "", "", "", ">", "", "", "", "<" ] will
+ only make vertical borders but not
+ horizontal ones. By default `FloatBorder`
+ highlight is used which links to `VertSplit`
+ when not defined. It could also be specified
+ by character: [ {"+", "MyCorner"}, {"x",
+ "MyBorder"} ]
+
Return: ~
Window handle, or 0 on error
@@ -1403,9 +1495,9 @@ nvim_put({lines}, {type}, {after}, {follow}) *nvim_put()*
• "c" |charwise| mode
• "l" |linewise| mode
• "" guess by contents, see |setreg()|
- {after} Insert after cursor (like |p|), or before (like
- |P|).
- {follow} Place cursor at end of inserted text.
+ {after} If true insert after cursor (like |p|), or
+ before (like |P|).
+ {follow} If true place cursor at end of inserted text.
*nvim_replace_termcodes()*
nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
@@ -1611,21 +1703,6 @@ nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()*
keys are also recognized: `default` : don't
override existing definition, like `hi default`
-nvim_set_hl_ns({ns_id}) *nvim_set_hl_ns()*
- 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.
-
- Attributes: ~
- {fast}
-
- Parameters: ~
- {ns_id} the namespace to activate
-
nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode.
@@ -1725,7 +1802,7 @@ nvim__buf_stats({buffer}) *nvim__buf_stats()*
TODO: Documentation
*nvim_buf_add_highlight()*
-nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line}, {col_start},
+nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start},
{col_end})
Adds a highlight to buffer.
@@ -1800,6 +1877,25 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• deleted_codeunits (if `utf_sizes` is
true)
+ • on_bytes: lua callback invoked on change.
+ This callback receives more granular
+ information about the change compared to
+ on_lines. Return`true`to detach. Args:
+ • the string "bytes"
+ • buffer handle
+ • b:changedtick
+ • start row of the changed text
+ (zero-indexed)
+ • start column of the changed text
+ • byte offset of the changed text (from
+ the start of the buffer)
+ • old end row of the changed text
+ • old end column of the changed text
+ • old end byte length of the changed text
+ • new end row of the changed text
+ • new end column of the changed text
+ • new end byte length of the changed text
+
• on_changedtick: Lua callback invoked on
changedtick increment without text
change. Args:
@@ -1812,6 +1908,12 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• the string "detach"
• buffer handle
+ • on_reload: Lua callback invoked on
+ reload. The entire buffer content should
+ be considered changed. Args:
+ • the string "detach"
+ • buffer handle
+
• utf_sizes: include UTF-32 and UTF-16 size
of the replaced region, as args to
`on_lines` .
@@ -1948,8 +2050,7 @@ nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
{ns_id} Namespace id from |nvim_create_namespace()|
{id} Extmark id
{opts} Optional parameters. Keys:
- • limit: Maximum number of marks to return
- • details Whether to include the details dict
+ • details: Whether to include the details dict
Return: ~
(row, col) tuple or empty list () if extmark id was absent
@@ -2159,6 +2260,26 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
• hl_group : name of the highlight group used to
highlight this mark.
• virt_text : virtual text to link to this mark.
+ • virt_text_pos : positioning of virtual text.
+ Possible values:
+ • "eol": right after eol character (default)
+ • "overlay": display over the specified
+ column, without shifting the underlying
+ text.
+
+ • virt_text_hide : hide the virtual text when
+ the background text is selected or hidden due
+ to horizontal scroll 'nowrap'
+ • hl_mode : control how highlights are combined
+ with the highlights of the text. Currently
+ only affects virt_text highlights, but might
+ affect`hl_group`in later versions.
+ • "replace": only show the virt_text color.
+ This is the default
+ • "combine": combine with background text
+ color
+ • "blend": blend with background text color.
+
• ephemeral : for use with
|nvim_set_decoration_provider| callbacks. The
mark will only be used for the current redraw
@@ -2173,6 +2294,9 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
exists) will be shifted in when new text is
inserted (true for right, false for left).
Defaults to false.
+ • priority: a priority value for the highlight
+ group. For example treesitter highlighting
+ uses a value of 100.
Return: ~
Id of the created/updated extmark
@@ -2425,6 +2549,21 @@ nvim_win_get_width({window}) *nvim_win_get_width()*
Return: ~
Width as a count of columns
+nvim_win_hide({window}) *nvim_win_hide()*
+ Closes the window and hide the buffer it contains (like
+ |:hide| with a |window-ID|).
+
+ Like |:hide| the buffer becomes hidden unless another window
+ is editing it, or 'bufhidden' is `unload` , `delete` or `wipe`
+ as opposed to |:close| or |nvim_win_close|, which will close
+ the buffer.
+
+ Attributes: ~
+ not allowed when |textlock| is active
+
+ Parameters: ~
+ {window} Window handle, or 0 for current window
+
nvim_win_is_valid({window}) *nvim_win_is_valid()*
Checks if a window is valid