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.txt106
1 files changed, 86 insertions, 20 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index b80ca9edd7..0c726ddd86 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -529,14 +529,6 @@ nvim__id_float({flt}) *nvim__id_float()*
nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()*
TODO: Documentation
- *nvim__put_attr()*
-nvim__put_attr({id}, {start_row}, {start_col}, {end_row}, {end_col})
- Set attrs in nvim__buf_set_lua_hl callbacks
-
- TODO(bfredl): This is rather pedestrian. The final interface
- should probably be derived from a reformed bufhl/virttext
- interface with full support for multi-line ranges etc
-
nvim__screenshot({path}) *nvim__screenshot()*
TODO: Documentation
@@ -1480,6 +1472,53 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
Parameters: ~
{window} Window handle
+ *nvim_set_decoration_provider()*
+nvim_set_decoration_provider({ns_id}, {opts})
+ Set or change decoration provider for a namespace
+
+ This is a very general purpose interface for having lua
+ callbacks being triggered during the redraw code.
+
+ The expected usage is to set extmarks for the currently
+ redrawn buffer. |nvim_buf_set_extmark| can be called to add
+ marks on a per-window or per-lines basis. Use the `ephemeral`
+ key to only use the mark for the current screen redraw (the
+ callback will be called again for the next redraw ).
+
+ Note: this function should not be called often. Rather, the
+ callbacks themselves can be used to throttle unneeded
+ callbacks. the `on_start` callback can return `false` to
+ disable the provider until the next redraw. Similarily, return
+ `false` in `on_win` will skip the `on_lines` calls for that
+ window (but any extmarks set in `on_win` will still be used).
+ A plugin managing multiple sources of decorations should
+ ideally only set one provider, and merge the sources
+ internally. You can use multiple `ns_id` for the extmarks
+ set/modified inside the callback anyway.
+
+ Note: doing anything other than setting extmarks is considered
+ experimental. Doing things like changing options are not
+ expliticly forbidden, but is likely to have unexpected
+ consequences (such as 100% CPU consumption). doing
+ `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite
+ dubious for the moment.
+
+ Parameters: ~
+ {ns_id} Namespace id from |nvim_create_namespace()|
+ {opts} Callbacks invoked during redraw:
+ • on_start: called first on each screen redraw
+ ["start", tick]
+ • on_buf: called for each buffer being redrawn
+ (before window callbacks) ["buf", bufnr, tick]
+ • on_win: called when starting to redraw a
+ specific window. ["win", winid, bufnr, topline,
+ botline_guess]
+ • on_line: called for each buffer line being
+ redrawn. (The interation with fold lines is
+ subject to change) ["win", winid, bufnr, row]
+ • on_end: called at the end of a redraw cycle
+ ["end", tick]
+
nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode.
@@ -1575,18 +1614,6 @@ to check whether a buffer is loaded.
nvim__buf_redraw_range({buffer}, {first}, {last})
TODO: Documentation
-nvim__buf_set_luahl({buffer}, {opts}) *nvim__buf_set_luahl()*
- Unstabilized interface for defining syntax hl in lua.
-
- This is not yet safe for general use, lua callbacks will need
- to be restricted, like textlock and probably other stuff.
-
- The API on_line/nvim__put_attr is quite raw and not intended
- to be the final shape. Ideally this should operate on chunks
- larger than a single line to reduce interpreter overhead, and
- generate annotation objects (bufhl/virttext) on the fly but
- using the same representation.
-
nvim__buf_stats({buffer}) *nvim__buf_stats()*
TODO: Documentation
@@ -1690,6 +1717,29 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|nvim_buf_detach()|
|api-buffer-updates-lua|
+nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
+ call a function with buffer as temporary current buffer
+
+ This temporarily switches current buffer to "buffer". If the
+ current window already shows "buffer", the window is not
+ switched If a window inside the current tabpage (including a
+ float) already shows the buffer One of these windows will be
+ set as current window temporarily. Otherwise a temporary
+ scratch window (calleed the "autocmd window" for historical
+ reasons) will be used.
+
+ This is useful e.g. to call vimL functions that only work with
+ the current buffer/window currently, like |termopen()|.
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer
+ {fun} Function to call inside the buffer (currently
+ lua callable only)
+
+ Return: ~
+ Return value of function. NB: will deepcopy lua values
+ currently, use upvalues to send lua references in and out.
+
*nvim_buf_clear_namespace()*
nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
Clears namespaced objects (highlights, extmarks, virtual text)
@@ -1733,6 +1783,17 @@ nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()*
{buffer} Buffer handle, or 0 for current buffer
{name} Variable name
+nvim_buf_delete({buffer}, {opts}) *nvim_buf_delete()*
+ Deletes the buffer. See |:bwipeout|
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer
+ {opts} Optional parameters. Keys:
+ • force: Force deletion and ignore unsaved
+ changes.
+ • unload: Unloaded only, do not delete. See
+ |:bunload|
+
nvim_buf_detach({buffer}) *nvim_buf_detach()*
Deactivates buffer-update events on the channel.
@@ -1986,6 +2047,11 @@ 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.
+ • ephemeral : for use with
+ |nvim_set_decoration_provider| callbacks. The
+ mark will only be used for the current redraw
+ cycle, and not be permantently stored in the
+ buffer.
Return: ~
Id of the created/updated extmark